Aspose.Words .NET如何實現文檔合並的同頁分頁顯示


當我們需要將一個文檔添加到另一個文檔時,經常會有不同的顯示需求。為了文檔的流暢,我們需要源文檔和目標文檔在內容上實現連續顯示;而為了更好地區分文檔,我們經常會希望兩個文檔的合並實現分頁顯示。

       下面,就讓我們給出具體實例來對Aspose.Words .NET 的同頁分頁顯示功能進行一個深入的了解:


一、同頁連續顯示


1、代碼:

C#

Document dstDoc = new Document(gDataDir + "TestFile.Destination.doc");
Document srcDoc =  new Document(gDataDir + "TestFile.Source.doc");

// Make the document appear straight after the destination documents content.
srcDoc.FirstSection.PageSetup.SectionStart = SectionStart.Continuous;

// Append the source document using the original styles found in the source document.
dstDoc.AppendDocument(srcDoc, ImportFormatMode.KeepSourceFormatting);
dstDoc.Save(gDataDir + "TestFile.JoinContinuous Out.doc");

 

二、另起一頁顯示

1、代碼:

C#

 Document dstDoc = new Document(gDataDir + "TestFile.Destination.doc");
Document srcDoc =  new Document(gDataDir + "TestFile.Source.doc");

// Set the appended document to start on a new page.
srcDoc.FirstSection.PageSetup.SectionStart = SectionStart.NewPage;

// Append the source document using the original styles found in the source document.
dstDoc.AppendDocument(srcDoc, ImportFormatMode.KeepSourceFormatting);
dstDoc.Save(gDataDir + "TestFile.JoinNewPage Out.doc");


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM