MergeFormatMode

MergeFormatMode enumeration

يحدد كيفية دمج التنسيق عند الجمع بين مستندات متعددة.

public enum MergeFormatMode

قيم

اسمقيمةوصف
MergeFormatting0دمج تنسيق المستندات المدمجة.
KeepSourceFormatting1يعني أن المستند المصدر سيحتفظ بتنسيقه الأصلي، مثل أنماط الخطوط وأحجامها وألوانها والمسافات البادئة وأي عناصر تنسيق أخرى يتم تطبيقها على محتواه.
KeepSourceLayout2الحفاظ على تخطيط المستندات الأصلية في المستند النهائي.

أمثلة

يوضح كيفية دمج المستندات في مستند إخراج واحد.

//هناك عدة طرق لدمج المستندات:
string inputDoc1 = MyDir + "Big document.docx";
string inputDoc2 = MyDir + "Tables.docx";

Merger.Merge(ArtifactsDir + "LowCode.MergeDocument.1.docx", new[] { inputDoc1, inputDoc2 });

OoxmlSaveOptions saveOptions = new OoxmlSaveOptions { Password = "Aspose.Words" };
Merger.Merge(ArtifactsDir + "LowCode.MergeDocument.2.docx", new[] { inputDoc1, inputDoc2 }, saveOptions, MergeFormatMode.KeepSourceFormatting);

Merger.Merge(ArtifactsDir + "LowCode.MergeDocument.3.pdf", new[] { inputDoc1, inputDoc2 }, SaveFormat.Pdf, MergeFormatMode.KeepSourceLayout);

LoadOptions firstLoadOptions = new LoadOptions() { IgnoreOleData = true };
LoadOptions secondLoadOptions = new LoadOptions() { IgnoreOleData = false };
Merger.Merge(ArtifactsDir + "LowCode.MergeDocument.4.docx", new[] { inputDoc1, inputDoc2 }, new[] { firstLoadOptions, secondLoadOptions }, saveOptions, MergeFormatMode.KeepSourceFormatting);

Document doc = Merger.Merge(new[] { inputDoc1, inputDoc2 }, MergeFormatMode.MergeFormatting);
doc.Save(ArtifactsDir + "LowCode.MergeDocument.5.docx");

doc = Merger.Merge(new[] { inputDoc1, inputDoc2 }, new[] { firstLoadOptions, secondLoadOptions }, MergeFormatMode.MergeFormatting);
doc.Save(ArtifactsDir + "LowCode.MergeDocument.6.docx");

أنظر أيضا