• <menu id="w2i4a"></menu>
  • logo Aspose中文文檔

    插入表格


    Aspose.Words是一種高級Word文檔處理API,用于執(zhí)行各種文檔管理和操作任務(wù)。API支持生成,修改,轉(zhuǎn)換,呈現(xiàn)和打印文檔,而無需在跨平臺應(yīng)用程序中直接使用Microsoft Word。

    Aspose API支持流行文件格式處理,并允許將各類文檔導(dǎo)出或轉(zhuǎn)換為固定布局文件格式和最常用的圖像/多媒體格式。

    Aspose.Words for .NET 最新下載

    VSTO
    Word.Application wordApp = Application;
    wordApp.Documents.Open("Inserting Table.doc");
    CreateDocumentPropertyTable();
    this.Application.ActiveDocument.Save();
    private void CreateDocumentPropertyTable()
    {
    object start = 0, end = 0;
    Word.Range rng = this.Application.ActiveDocument.Range(ref start, ref end);
    
    // Insert a title for the table and paragraph marks.
    rng.InsertBefore("Document Statistics");
    rng.Font.Name = "Verdana";
    rng.Font.Size = 16;
    rng.InsertParagraphAfter();
    rng.InsertParagraphAfter();
    rng.SetRange(rng.End, rng.End);
    
    // Add the table.
    rng.Tables.Add(this.Application.ActiveDocument.Paragraphs[2].Range, 3, 2, ref missing, ref missing);
    
    // Format the table and apply a style.
    Word.Table tbl = this.Application.ActiveDocument.Tables[1];
    tbl.Range.Font.Size = 12;
    tbl.Columns.DistributeWidth();
    object styleName = "Table Professional";
    tbl.set_Style(ref styleName);
    
    // Insert document properties into cells.
    tbl.Cell(1, 1).Range.Text = "Document Property";
    tbl.Cell(1, 2).Range.Text = "Value";
    tbl.Cell(2, 1).Range.Text = "Subject";
    tbl.Cell(2, 2).Range.Text = ((Office.DocumentProperties)(this.Application.ActiveDocument.BuiltInDocumentProperties))
    [Word.WdBuiltInProperty.wdPropertySubject].Value.ToString();
    tbl.Cell(3, 1).Range.Text = "Author";
    tbl.Cell(3, 2).Range.Text = ((Office.DocumentProperties)(this.Application.ActiveDocument.BuiltInDocumentProperties))
    [Word.WdBuiltInProperty.wdPropertyAuthor].Value.ToString();
    }

    點擊復(fù)制

    Aspose.Words

    Document doc = new Document("Inserting Table.doc");
    DocumentBuilder builder = new DocumentBuilder(doc);
    
    // We call this method to start building the table.
    builder.StartTable();
    builder.InsertCell();
    builder.Write("Row 1, Cell 1 Content.");
    
    // Build the second cell
    builder.InsertCell();
    builder.Write("Row 1, Cell 2 Content.");
    
    // Call the following method to end the row and start a new row.
    builder.EndRow();
    
    // Build the first cell of the second row.
    builder.InsertCell();
    builder.Write("Row 2, Cell 1 Content");
    
    // Build the second cell.
    builder.InsertCell();
    builder.Write("Row 2, Cell 2 Content.");
    builder.EndRow();
    
    // Signal that we have finished building the table.
    builder.EndTable();
    
    // Save the document to disk.
    doc.Save("Inserting Table.doc");

    點擊復(fù)制

    下載示例代碼

    掃碼咨詢


    添加微信 立即咨詢

    電話咨詢

    客服熱線
    023-68661681

    TOP
    三级成人熟女影院,欧美午夜成人精品视频,亚洲国产成人乱色在线观看,色中色成人论坛 (function(){ var bp = document.createElement('script'); var curProtocol = window.location.protocol.split(':')[0]; if (curProtocol === 'https') { bp.src = 'https://zz.bdstatic.com/linksubmit/push.js'; } else { bp.src = 'http://push.zhanzhang.baidu.com/push.js'; } var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(bp, s); })();