文檔半島外圍網(wǎng)上直營>>E-iceblue中文文檔>>克隆一個 word 文檔
                克隆一個 word 文檔
使用 Spire.Doc,我們可以在 C#中將內(nèi)容從一個 word 文檔復制到另一個 word 文檔。當我們需要從單個文檔生成大量文檔時,克隆文檔會容易得多。clone方法加快了word文檔的生成速度,開發(fā)者只需要一行代碼就可以得到word文檔的副本。
現(xiàn)在我們將展示如何在 C# 中克隆 word 文檔的代碼片段。
第 1 步:創(chuàng)建 Document 的新實例并從文件加載文檔。
Document doc = new Document();
doc.LoadFromFile("Sample.docx",FileFormat.Docx2010);
第2步:克隆word文檔。
doc.Clone();
第 3 步:將文檔保存到文件中。
doc.SaveToFile("Cloneword.docx", FileFormat.Docx2010);
克隆word文檔的有效截圖:
	 
 
克隆word文檔的完整代碼:
using Spire.Doc;
namespace CloneWord
{
class Program
{
static void Main(string[] args)
{
Document doc = new Document();
doc.LoadFromFile("Sample.docx", FileFormat.Docx2010);
doc.Clone();
doc.SaveToFile("Cloneword.docx", FileFormat.Docx2010);
}
}
}
歡迎下載|體驗更多E-iceblue產(chǎn)品


 QQ交談
QQ交談 在線咨詢
在線咨詢 
                 
                
 渝公網(wǎng)安備
            50010702500608號
渝公網(wǎng)安備
            50010702500608號
             
            
 客服熱線
客服熱線