源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

解决用Aspose.Words,在word文档中创建表格的实现方法

  • 时间:2022-01-11 10:30 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要:解决用Aspose.Words,在word文档中创建表格的实现方法
[b]代码如下所示: [/b]
[u]复制代码[/u] 代码如下:
  //Open document and create Documentbuilder   Aspose.Words.Document doc = new Aspose.Words.Document("demo.doc");   DocumentBuilder builder = new DocumentBuilder(doc);   //Set table formating   //Set borders   builder.CellFormat.Borders.LineStyle = LineStyle.Single;   builder.CellFormat.Borders.Color = Color.Red;   //Set left indent   builder.RowFormat.LeftIndent = 100;   // etc...   //Move documentBuilder cursor to the bookmark   builder.MoveToBookmark("myBookmark");   //Insert some table   for (int i = 0; i < 5; i++)   {        for (int j = 0; j < 5; j++)        {             builder.InsertCell();             builder.Write("this is cell");        }        builder.EndRow();   }   builder.EndTable();   //Save output document   doc.Save("demo2.doc");
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部