• 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);
                        }
    一次性复制某页
  • 相关阅读:
    这几天都是在公司慢待
    电脑没有关机可能出现发博文dns异常(write)
    DOS/VBS
    SourceInsight
    CevaEclipse
    C/C++
    Matlab
    Matlab
    C语言
    Matlab
  • 原文地址:https://www.cnblogs.com/happyqiang/p/16075619.html
Copyright © 2020-2023  润新知