原創(chuàng)|其它|編輯:郝浩|2012-09-19 13:37:06.000|閱讀 4359 次
概述:當(dāng)我們需要將一個文檔添加到另一個文檔時,經(jīng)常會有不同的顯示需求。為了文檔的流暢,我們需要源文檔和目標(biāo)文檔在內(nèi)容上實現(xiàn)連續(xù)顯示;而為了更好地區(qū)分文檔,我們經(jīng)常會希望兩個文檔的合并實現(xiàn)分頁顯示。
# 界面/圖表報表/文檔/IDE等千款熱門軟控件火熱銷售中 >>
當(dāng)我們需要將一個文檔添加到另一個文檔時,經(jīng)常會有不同的顯示需求。為了文檔的流暢,我們需要源文檔和目標(biāo)文檔在內(nèi)容上實現(xiàn)連續(xù)顯示;而為了更好地區(qū)分文檔,我們經(jīng)常會希望兩個文檔的合并實現(xiàn)分頁顯示。
下面,就讓我們給出具體實例來對Aspose.Words .NET 的同頁分頁顯示功能進(jìn)行一個深入的了解:
一、同頁連續(xù)顯示
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");
Visual Basic
Dim dstDoc As New Document(gDataDir & "TestFile.Destination.doc")
Dim srcDoc As 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")
2、效果圖:
二、另起一頁顯示
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");
Visual Basic
Dim dstDoc As New Document(gDataDir & "TestFile.Destination.doc")
Dim srcDoc As 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")
2、效果圖:
本站文章除注明轉(zhuǎn)載外,均為本站原創(chuàng)或翻譯。歡迎任何形式的轉(zhuǎn)載,但請務(wù)必注明出處、不得修改原文相關(guān)鏈接,如果存在內(nèi)容上的異議請郵件反饋至chenjj@fc6vip.cn
文章轉(zhuǎn)載自:慧都控件網(wǎng)