• Aspose.Word页的操作


    一:某表格后面要复制n个表格:

    int copytbs = buildnumlist.Count - 1;
                        Aspose.Words.Tables.Table tb = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, 1, true);
                        for (int i = 0; i < copytbs; i++)
                        {
                            //创建段落
                            Paragraph lastParagraph = new Paragraph(doc);
                            //第一个表格末尾加段落
                            tb.ParentNode.InsertAfter(lastParagraph, tb);
                            //
                            Run pageBreakRun = new Run(doc, ControlChar.PageBreak);
                            lastParagraph.AppendChild(pageBreakRun);
                            Aspose.Words.Tables.Table cloneTable = (Aspose.Words.Tables.Table)tb.Clone(true);
                            //在文档末尾段落后面加入复制的表格
                            tb.ParentNode.InsertAfter(cloneTable, lastParagraph);
                            lastParagraph = new Aspose.Words.Paragraph(doc);
                        }
                        tb = (Aspose.Words.Tables.Table)doc.GetChild(NodeType.Table, 0, true);
                        for (int i = 0; i < copytbs; i++)
                        {
                            //创建段落
                            Paragraph lastParagraph = new Paragraph(doc);
                            //第一个表格末尾加段落
                            tb.ParentNode.InsertAfter(lastParagraph, tb);
                            //
                            Run pageBreakRun = new Run(doc, ControlChar.PageBreak);
                            lastParagraph.AppendChild(pageBreakRun);
                            Aspose.Words.Tables.Table cloneTable = (Aspose.Words.Tables.Table)tb.Clone(true);
                            //在文档末尾段落后面加入复制的表格
                            tb.ParentNode.InsertAfter(cloneTable, lastParagraph);
                            lastParagraph = new Aspose.Words.Paragraph(doc);
                        }
    在某表格后循环插入新页表格

    二:一次性复制页:

     Aspose.Words.Document docpage = AsposeWordHelper.GetDocPage(doc, 1);
                        //先一次性复制表格页:
                        for (int i = 1; i < buildnumlist.Count; i++)
                        {
                            doc.AppendDocument(docpage, ImportFormatMode.KeepSourceFormatting);
                        }
    一次性复制某页
  • 相关阅读:
    ubuntu16.04左边栏图标效果设置
    VMware虚拟机 Ubuntu 16.04 安装 VMware Tools
    微信换取openid的值
    thinkphp关于T方法
    Think关于循环的事
    base64格式转换为图片
    Think视图模型格式
    thinkphp里多表事务
    ThinkPHP数据库驱动之mysql事物回滚
    webhook是啥?
  • 原文地址:https://www.cnblogs.com/happyqiang/p/16075619.html
Copyright © 2020-2023  润新知