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

软件发布|下载排行|最新软件

当前位置:首页IT学院IT技术

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

  2021-03-18 我要评论
想了解解决用Aspose.Words,在word文档中创建表格的实现方法的相关内容吗,在本文为您仔细讲解Aspose.Words的相关知识和一些Code实例,欢迎阅读和指正,我们先划重点:Aspose.Words,word,创建表格,下面大家一起来学习吧。
代码如下所示:
复制代码 代码如下:

  //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");

猜您喜欢

Copyright 2022 版权所有 软件发布 访问手机版

声明:所有软件和文章来自软件开发商或者作者 如有异议 请与本站联系 联系我们