Search in sources :

Example 56 with Variant

use of com.jacob.com.Variant in project yyl_example by Relucent.

the class JacobWordEngine method createTable.

/**
   * 创建表格
   * 
   * @param pos
   *        位置
   * @param cols
   *        列数
   * @param rows
   *        行数
   */
public void createTable(String pos, int numCols, int numRows) {
    if (find(pos)) {
        Dispatch tables = Dispatch.get(doc, "Tables").toDispatch();
        Dispatch range = Dispatch.get(selection, "Range").toDispatch();
        @SuppressWarnings("unused") Dispatch newTable = Dispatch.call(tables, "Add", range, new Variant(numRows), new Variant(numCols), new Variant(1)).toDispatch();
        Dispatch.call(selection, "MoveRight");
    } else {
        Dispatch tables = Dispatch.get(doc, "Tables").toDispatch();
        Dispatch range = Dispatch.get(selection, "Range").toDispatch();
        @SuppressWarnings("unused") Dispatch newTable = Dispatch.call(tables, "Add", range, new Variant(numRows), new Variant(numCols), new Variant(1)).toDispatch();
        Dispatch.call(selection, "MoveRight");
    }
}
Also used : Variant(com.jacob.com.Variant) Dispatch(com.jacob.com.Dispatch)

Example 57 with Variant

use of com.jacob.com.Variant in project yyl_example by Relucent.

the class JacobWordEngine method closeDocument.

/**
   * 关闭当前word文档
   */
public void closeDocument() {
    if (doc != null) {
        Dispatch.call(doc, "Save");
        Dispatch.call(doc, "Close", new Variant(saveOnExit));
        doc = null;
    }
}
Also used : Variant(com.jacob.com.Variant)

Example 58 with Variant

use of com.jacob.com.Variant in project yyl_example by Relucent.

the class JacobWordEngine method setCellVerticalAlign.

/**
   * 设置选定单元格的垂直对起方式, 请使用setTableCellSelected选中一个单元格
   * 
   * @param align
   *        0-顶端, 1-居中, 3-底端
   */
public void setCellVerticalAlign(int verticalAlign) {
    Dispatch cells = Dispatch.get(selection, "Cells").toDispatch();
    Dispatch.put(cells, "VerticalAlignment", new Variant(verticalAlign));
}
Also used : Variant(com.jacob.com.Variant) Dispatch(com.jacob.com.Dispatch)

Example 59 with Variant

use of com.jacob.com.Variant in project yyl_example by Relucent.

the class JacobWordEngine method autoFitTable.

/**
   * 自动调整表格
   * 
   */
public void autoFitTable() {
    Dispatch tables = Dispatch.get(doc, "Tables").toDispatch();
    int count = Dispatch.get(tables, "Count").getInt();
    for (int i = 0; i < count; i++) {
        Dispatch table = Dispatch.call(tables, "Item", new Variant(i + 1)).toDispatch();
        Dispatch cols = Dispatch.get(table, "Columns").toDispatch();
        Dispatch.call(cols, "AutoFit");
    }
}
Also used : Variant(com.jacob.com.Variant) Dispatch(com.jacob.com.Dispatch)

Example 60 with Variant

use of com.jacob.com.Variant in project yyl_example by Relucent.

the class JacobWordEngine method addLastTableRow.

/**
   * 在最后1行前增加一行
   * 
   * @param tableIndex
   *        word文档中的第N张表(从1开始)
   */
public void addLastTableRow(int tableIndex) {
    // 所有表格
    Dispatch tables = Dispatch.get(doc, "Tables").toDispatch();
    // 要填充的表格
    Dispatch table = Dispatch.call(tables, "Item", new Variant(tableIndex)).toDispatch();
    // 表格的所有行
    Dispatch rows = Dispatch.get(table, "Rows").toDispatch();
    Dispatch row = Dispatch.get(rows, "Last").toDispatch();
    Dispatch.call(rows, "Add", new Variant(row));
}
Also used : Variant(com.jacob.com.Variant) Dispatch(com.jacob.com.Dispatch)

Aggregations

Variant (com.jacob.com.Variant)100 Dispatch (com.jacob.com.Dispatch)45 ActiveXComponent (com.jacob.activeX.ActiveXComponent)18 ComFailException (com.jacob.com.ComFailException)17 Message (de.janrufmonitor.exception.Message)13 ICallerList (de.janrufmonitor.framework.ICallerList)13 ZipArchiveException (de.janrufmonitor.repository.zip.ZipArchiveException)13 SQLException (java.sql.SQLException)13 ArrayList (java.util.ArrayList)13 List (java.util.List)13 IAttribute (de.janrufmonitor.framework.IAttribute)6 SimpleDateFormat (java.text.SimpleDateFormat)2 Date (java.util.Date)2 SafeArray (com.jacob.com.SafeArray)1 ICaller (de.janrufmonitor.framework.ICaller)1 IMultiPhoneCaller (de.janrufmonitor.framework.IMultiPhoneCaller)1 IPhonenumber (de.janrufmonitor.framework.IPhonenumber)1 UUID (de.janrufmonitor.util.uuid.UUID)1 Properties (java.util.Properties)1