Merge
Merge(string, string[])
Объединяет указанные входные документы в один выходной документ, используя указанные входные и имена выходных файлов, используяKeepSourceFormatting .
public static void Merge(string outputFile, string[] inputFiles)
Параметр | Тип | Описание |
---|---|---|
outputFile | String | Имя выходного файла. |
inputFiles | String[] | Имена входных файлов. |
Примечания
Если выходной формат — изображение (BMP, EMF, EPS, GIF, JPEG, PNG или WebP), каждая страница выходных данных будет сохранена как отдельный файл. Указанное имя выходного файла будет использоваться для генерации имен файлов для каждой части в соответствии с правилом: outputFile_partIndex.extension.
Если выходной формат — TIFF, вывод будет сохранен как один многокадровый файл TIFF.
Примеры
Показывает, как объединить документы в один выходной документ.
//Существует несколько способов объединения документов:
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");
Смотрите также
- class Merger
- пространство имен Aspose.Words.LowCode
- сборка Aspose.Words
Merge(string, string[], SaveFormat, MergeFormatMode)
Объединяет указанные входные документы в один выходной документ, используя указанные имена входных/выходных файлов и формат конечного документа.
public static void Merge(string outputFile, string[] inputFiles, SaveFormat saveFormat,
MergeFormatMode mergeFormatMode)
Параметр | Тип | Описание |
---|---|---|
outputFile | String | Имя выходного файла. |
inputFiles | String[] | Имена входных файлов. |
saveFormat | SaveFormat | Формат сохранения. |
mergeFormatMode | MergeFormatMode | Указывает, как объединить конфликтующее форматирование. |
Примечания
Если выходной формат — изображение (BMP, EMF, EPS, GIF, JPEG, PNG или WebP), каждая страница выходных данных будет сохранена как отдельный файл. Указанное имя выходного файла будет использоваться для генерации имен файлов для каждой части в соответствии с правилом: outputFile_partIndex.extension.
Если выходной формат — TIFF, вывод будет сохранен как один многокадровый файл TIFF.
Примеры
Показывает, как объединить документы в один выходной документ.
//Существует несколько способов объединения документов:
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");
Смотрите также
- enum SaveFormat
- enum MergeFormatMode
- class Merger
- пространство имен Aspose.Words.LowCode
- сборка Aspose.Words
Merge(string, string[], SaveOptions, MergeFormatMode)
Объединяет указанные входные документы в один выходной документ, используя указанные имена входных и выходных файлов и параметры сохранения.
public static void Merge(string outputFile, string[] inputFiles, SaveOptions saveOptions,
MergeFormatMode mergeFormatMode)
Параметр | Тип | Описание |
---|---|---|
outputFile | String | Имя выходного файла. |
inputFiles | String[] | Имена входных файлов. |
saveOptions | SaveOptions | Параметры сохранения. |
mergeFormatMode | MergeFormatMode | Указывает, как объединить конфликтующее форматирование. |
Примечания
Если выходной формат — изображение (BMP, EMF, EPS, GIF, JPEG, PNG или WebP), каждая страница выходных данных будет сохранена как отдельный файл. Указанное имя выходного файла будет использоваться для генерации имен файлов для каждой части в соответствии с правилом: outputFile_partIndex.extension.
Если выходной формат — TIFF, вывод будет сохранен как один многокадровый файл TIFF.
Примеры
Показывает, как объединить документы в один выходной документ.
//Существует несколько способов объединения документов:
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");
Смотрите также
- class SaveOptions
- enum MergeFormatMode
- class Merger
- пространство имен Aspose.Words.LowCode
- сборка Aspose.Words
Merge(string, string[], LoadOptions[], SaveOptions, MergeFormatMode)
Объединяет указанные входные документы в один выходной документ, используя указанные имена входных и выходных файлов и параметры сохранения.
public static void Merge(string outputFile, string[] inputFiles, LoadOptions[] loadOptions,
SaveOptions saveOptions, MergeFormatMode mergeFormatMode)
Параметр | Тип | Описание |
---|---|---|
outputFile | String | Имя выходного файла. |
inputFiles | String[] | Имена входных файлов. |
loadOptions | LoadOptions[] | Параметры загрузки входных файлов. |
saveOptions | SaveOptions | Параметры сохранения. |
mergeFormatMode | MergeFormatMode | Указывает, как объединить конфликтующее форматирование. |
Примечания
Если выходной формат — изображение (BMP, EMF, EPS, GIF, JPEG, PNG или WebP), каждая страница выходных данных будет сохранена как отдельный файл. Указанное имя выходного файла будет использоваться для генерации имен файлов для каждой части в соответствии с правилом: outputFile_partIndex.extension.
Если выходной формат — TIFF, вывод будет сохранен как один многокадровый файл TIFF.
Примеры
Показывает, как объединить документы в один выходной документ.
//Существует несколько способов объединения документов:
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");
Смотрите также
- class LoadOptions
- class SaveOptions
- enum MergeFormatMode
- class Merger
- пространство имен Aspose.Words.LowCode
- сборка Aspose.Words
Merge(string[], MergeFormatMode)
Объединяет указанные входные документы в один документ и возвращаетDocument
экземпляр окончательного документа.
public static Document Merge(string[] inputFiles, MergeFormatMode mergeFormatMode)
Параметр | Тип | Описание |
---|---|---|
inputFiles | String[] | Имена входных файлов. |
mergeFormatMode | MergeFormatMode | Указывает, как объединить конфликтующее форматирование. |
Примеры
Показывает, как объединить документы в один выходной документ.
//Существует несколько способов объединения документов:
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");
Смотрите также
- class Document
- enum MergeFormatMode
- class Merger
- пространство имен Aspose.Words.LowCode
- сборка Aspose.Words
Merge(string[], LoadOptions[], MergeFormatMode)
Объединяет указанные входные документы в один документ и возвращаетDocument
экземпляр окончательного документа.
public static Document Merge(string[] inputFiles, LoadOptions[] loadOptions,
MergeFormatMode mergeFormatMode)
Параметр | Тип | Описание |
---|---|---|
inputFiles | String[] | Имена входных файлов. |
loadOptions | LoadOptions[] | Параметры загрузки входных файлов. |
mergeFormatMode | MergeFormatMode | Указывает, как объединить конфликтующее форматирование. |
Примеры
Показывает, как объединить документы в один выходной документ.
//Существует несколько способов объединения документов:
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");
Смотрите также
- class Document
- class LoadOptions
- enum MergeFormatMode
- class Merger
- пространство имен Aspose.Words.LowCode
- сборка Aspose.Words
Merge(Document[], MergeFormatMode)
Объединяет указанные входные документы в один документ и возвращаетDocument
экземпляр окончательного документа.
public static Document Merge(Document[] inputDocuments, MergeFormatMode mergeFormatMode)
Параметр | Тип | Описание |
---|---|---|
inputDocuments | Document[] | Входные документы. |
mergeFormatMode | MergeFormatMode | Указывает, как объединить конфликтующее форматирование. |
Примеры
Показывает, как объединить входные документы в один экземпляр документа.
DocumentBuilder firstDoc = new DocumentBuilder();
firstDoc.Font.Size = 16;
firstDoc.Font.Color = Color.Blue;
firstDoc.Write("Hello first word!");
DocumentBuilder secondDoc = new DocumentBuilder();
secondDoc.Write("Hello second word!");
Document mergedDoc = Merger.Merge(new Document[] { firstDoc.Document, secondDoc.Document }, MergeFormatMode.KeepSourceLayout);
Assert.AreEqual("Hello first word!\fHello second word!\f", mergedDoc.GetText());
Смотрите также
- class Document
- enum MergeFormatMode
- class Merger
- пространство имен Aspose.Words.LowCode
- сборка Aspose.Words
Merge(Stream, Stream[], SaveFormat)
Объединяет указанные входные документы в один выходной документ, используя указанные входные/выходные потоки и формат конечного документа.
public static void Merge(Stream outputStream, Stream[] inputStreams, SaveFormat saveFormat)
Параметр | Тип | Описание |
---|---|---|
outputStream | Stream | Выходной поток. |
inputStreams | Stream[] | Входные потоки. |
saveFormat | SaveFormat | Формат сохранения. |
Примечания
Если выходной формат представляет собой изображение (BMP, EMF, EPS, GIF, JPEG, PNG или WebP), в указанном потоке будет сохранена только первая страница вывода.
Если выходной формат — TIFF, вывод будет сохранен как один многокадровый TIFF в указанном потоке.
Примеры
Показывает, как объединить документы из потока в один выходной документ.
//Есть несколько способов объединения документов из потока:
using (FileStream firstStreamIn = new FileStream(MyDir + "Big document.docx", FileMode.Open, FileAccess.Read))
{
using (FileStream secondStreamIn = new FileStream(MyDir + "Tables.docx", FileMode.Open, FileAccess.Read))
{
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions { Password = "Aspose.Words" };
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamDocument.1.docx", FileMode.Create, FileAccess.ReadWrite))
Merger.Merge(streamOut, new[] { firstStreamIn, secondStreamIn }, saveOptions, MergeFormatMode.KeepSourceFormatting);
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamDocument.2.docx", FileMode.Create, FileAccess.ReadWrite))
Merger.Merge(streamOut, new[] { firstStreamIn, secondStreamIn }, SaveFormat.Docx);
LoadOptions firstLoadOptions = new LoadOptions() { IgnoreOleData = true };
LoadOptions secondLoadOptions = new LoadOptions() { IgnoreOleData = false };
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamDocument.3.docx", FileMode.Create, FileAccess.ReadWrite))
Merger.Merge(streamOut, new[] { firstStreamIn, secondStreamIn }, new[] { firstLoadOptions, secondLoadOptions }, saveOptions, MergeFormatMode.KeepSourceFormatting);
Document firstDoc = Merger.Merge(new[] { firstStreamIn, secondStreamIn }, MergeFormatMode.MergeFormatting);
firstDoc.Save(ArtifactsDir + "LowCode.MergeStreamDocument.4.docx");
Document secondDoc = Merger.Merge(new[] { firstStreamIn, secondStreamIn }, new[] { firstLoadOptions, secondLoadOptions }, MergeFormatMode.MergeFormatting);
secondDoc.Save(ArtifactsDir + "LowCode.MergeStreamDocument.5.docx");
}
}
Смотрите также
- enum SaveFormat
- class Merger
- пространство имен Aspose.Words.LowCode
- сборка Aspose.Words
Merge(Stream, Stream[], SaveOptions, MergeFormatMode)
Объединяет указанные входные документы в один выходной документ, используя указанные потоки ввода-вывода и параметры сохранения.
public static void Merge(Stream outputStream, Stream[] inputStreams, SaveOptions saveOptions,
MergeFormatMode mergeFormatMode)
Параметр | Тип | Описание |
---|---|---|
outputStream | Stream | Выходной поток. |
inputStreams | Stream[] | Входные потоки. |
saveOptions | SaveOptions | Параметры сохранения. |
mergeFormatMode | MergeFormatMode | Указывает, как объединить конфликтующее форматирование. |
Примечания
Если выходной формат представляет собой изображение (BMP, EMF, EPS, GIF, JPEG, PNG или WebP), в указанном потоке будет сохранена только первая страница вывода.
Если выходной формат — TIFF, вывод будет сохранен как один многокадровый TIFF в указанном потоке.
Примеры
Показывает, как объединить документы из потока в один выходной документ.
//Есть несколько способов объединения документов из потока:
using (FileStream firstStreamIn = new FileStream(MyDir + "Big document.docx", FileMode.Open, FileAccess.Read))
{
using (FileStream secondStreamIn = new FileStream(MyDir + "Tables.docx", FileMode.Open, FileAccess.Read))
{
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions { Password = "Aspose.Words" };
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamDocument.1.docx", FileMode.Create, FileAccess.ReadWrite))
Merger.Merge(streamOut, new[] { firstStreamIn, secondStreamIn }, saveOptions, MergeFormatMode.KeepSourceFormatting);
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamDocument.2.docx", FileMode.Create, FileAccess.ReadWrite))
Merger.Merge(streamOut, new[] { firstStreamIn, secondStreamIn }, SaveFormat.Docx);
LoadOptions firstLoadOptions = new LoadOptions() { IgnoreOleData = true };
LoadOptions secondLoadOptions = new LoadOptions() { IgnoreOleData = false };
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamDocument.3.docx", FileMode.Create, FileAccess.ReadWrite))
Merger.Merge(streamOut, new[] { firstStreamIn, secondStreamIn }, new[] { firstLoadOptions, secondLoadOptions }, saveOptions, MergeFormatMode.KeepSourceFormatting);
Document firstDoc = Merger.Merge(new[] { firstStreamIn, secondStreamIn }, MergeFormatMode.MergeFormatting);
firstDoc.Save(ArtifactsDir + "LowCode.MergeStreamDocument.4.docx");
Document secondDoc = Merger.Merge(new[] { firstStreamIn, secondStreamIn }, new[] { firstLoadOptions, secondLoadOptions }, MergeFormatMode.MergeFormatting);
secondDoc.Save(ArtifactsDir + "LowCode.MergeStreamDocument.5.docx");
}
}
Смотрите также
- class SaveOptions
- enum MergeFormatMode
- class Merger
- пространство имен Aspose.Words.LowCode
- сборка Aspose.Words
Merge(Stream, Stream[], LoadOptions[], SaveOptions, MergeFormatMode)
Объединяет указанные входные документы в один выходной документ, используя указанные потоки ввода-вывода и параметры сохранения.
public static void Merge(Stream outputStream, Stream[] inputStreams, LoadOptions[] loadOptions,
SaveOptions saveOptions, MergeFormatMode mergeFormatMode)
Параметр | Тип | Описание |
---|---|---|
outputStream | Stream | Выходной поток. |
inputStreams | Stream[] | Входные потоки. |
loadOptions | LoadOptions[] | Параметры загрузки входных файлов. |
saveOptions | SaveOptions | Параметры сохранения. |
mergeFormatMode | MergeFormatMode | Указывает, как объединить конфликтующее форматирование. |
Примечания
Если выходной формат представляет собой изображение (BMP, EMF, EPS, GIF, JPEG, PNG или WebP), в указанном потоке будет сохранена только первая страница вывода.
Если выходной формат — TIFF, вывод будет сохранен как один многокадровый TIFF в указанном потоке.
Примеры
Показывает, как объединить документы из потока в один выходной документ.
//Есть несколько способов объединения документов из потока:
using (FileStream firstStreamIn = new FileStream(MyDir + "Big document.docx", FileMode.Open, FileAccess.Read))
{
using (FileStream secondStreamIn = new FileStream(MyDir + "Tables.docx", FileMode.Open, FileAccess.Read))
{
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions { Password = "Aspose.Words" };
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamDocument.1.docx", FileMode.Create, FileAccess.ReadWrite))
Merger.Merge(streamOut, new[] { firstStreamIn, secondStreamIn }, saveOptions, MergeFormatMode.KeepSourceFormatting);
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamDocument.2.docx", FileMode.Create, FileAccess.ReadWrite))
Merger.Merge(streamOut, new[] { firstStreamIn, secondStreamIn }, SaveFormat.Docx);
LoadOptions firstLoadOptions = new LoadOptions() { IgnoreOleData = true };
LoadOptions secondLoadOptions = new LoadOptions() { IgnoreOleData = false };
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamDocument.3.docx", FileMode.Create, FileAccess.ReadWrite))
Merger.Merge(streamOut, new[] { firstStreamIn, secondStreamIn }, new[] { firstLoadOptions, secondLoadOptions }, saveOptions, MergeFormatMode.KeepSourceFormatting);
Document firstDoc = Merger.Merge(new[] { firstStreamIn, secondStreamIn }, MergeFormatMode.MergeFormatting);
firstDoc.Save(ArtifactsDir + "LowCode.MergeStreamDocument.4.docx");
Document secondDoc = Merger.Merge(new[] { firstStreamIn, secondStreamIn }, new[] { firstLoadOptions, secondLoadOptions }, MergeFormatMode.MergeFormatting);
secondDoc.Save(ArtifactsDir + "LowCode.MergeStreamDocument.5.docx");
}
}
Смотрите также
- class LoadOptions
- class SaveOptions
- enum MergeFormatMode
- class Merger
- пространство имен Aspose.Words.LowCode
- сборка Aspose.Words
Merge(Stream[], MergeFormatMode)
Объединяет указанные входные документы в один документ и возвращаетDocument
экземпляр окончательного документа.
public static Document Merge(Stream[] inputStreams, MergeFormatMode mergeFormatMode)
Параметр | Тип | Описание |
---|---|---|
inputStreams | Stream[] | Входные потоки. |
mergeFormatMode | MergeFormatMode | Указывает, как объединить конфликтующее форматирование. |
Примеры
Показывает, как объединить документы из потока в один выходной документ.
//Есть несколько способов объединения документов из потока:
using (FileStream firstStreamIn = new FileStream(MyDir + "Big document.docx", FileMode.Open, FileAccess.Read))
{
using (FileStream secondStreamIn = new FileStream(MyDir + "Tables.docx", FileMode.Open, FileAccess.Read))
{
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions { Password = "Aspose.Words" };
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamDocument.1.docx", FileMode.Create, FileAccess.ReadWrite))
Merger.Merge(streamOut, new[] { firstStreamIn, secondStreamIn }, saveOptions, MergeFormatMode.KeepSourceFormatting);
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamDocument.2.docx", FileMode.Create, FileAccess.ReadWrite))
Merger.Merge(streamOut, new[] { firstStreamIn, secondStreamIn }, SaveFormat.Docx);
LoadOptions firstLoadOptions = new LoadOptions() { IgnoreOleData = true };
LoadOptions secondLoadOptions = new LoadOptions() { IgnoreOleData = false };
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamDocument.3.docx", FileMode.Create, FileAccess.ReadWrite))
Merger.Merge(streamOut, new[] { firstStreamIn, secondStreamIn }, new[] { firstLoadOptions, secondLoadOptions }, saveOptions, MergeFormatMode.KeepSourceFormatting);
Document firstDoc = Merger.Merge(new[] { firstStreamIn, secondStreamIn }, MergeFormatMode.MergeFormatting);
firstDoc.Save(ArtifactsDir + "LowCode.MergeStreamDocument.4.docx");
Document secondDoc = Merger.Merge(new[] { firstStreamIn, secondStreamIn }, new[] { firstLoadOptions, secondLoadOptions }, MergeFormatMode.MergeFormatting);
secondDoc.Save(ArtifactsDir + "LowCode.MergeStreamDocument.5.docx");
}
}
Смотрите также
- class Document
- enum MergeFormatMode
- class Merger
- пространство имен Aspose.Words.LowCode
- сборка Aspose.Words
Merge(Stream[], LoadOptions[], MergeFormatMode)
Объединяет указанные входные документы в один документ и возвращаетDocument
экземпляр окончательного документа.
public static Document Merge(Stream[] inputStreams, LoadOptions[] loadOptions,
MergeFormatMode mergeFormatMode)
Параметр | Тип | Описание |
---|---|---|
inputStreams | Stream[] | Входные потоки. |
loadOptions | LoadOptions[] | Параметры загрузки входных файлов. |
mergeFormatMode | MergeFormatMode | Указывает, как объединить конфликтующее форматирование. |
Примеры
Показывает, как объединить документы из потока в один выходной документ.
//Есть несколько способов объединения документов из потока:
using (FileStream firstStreamIn = new FileStream(MyDir + "Big document.docx", FileMode.Open, FileAccess.Read))
{
using (FileStream secondStreamIn = new FileStream(MyDir + "Tables.docx", FileMode.Open, FileAccess.Read))
{
OoxmlSaveOptions saveOptions = new OoxmlSaveOptions { Password = "Aspose.Words" };
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamDocument.1.docx", FileMode.Create, FileAccess.ReadWrite))
Merger.Merge(streamOut, new[] { firstStreamIn, secondStreamIn }, saveOptions, MergeFormatMode.KeepSourceFormatting);
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamDocument.2.docx", FileMode.Create, FileAccess.ReadWrite))
Merger.Merge(streamOut, new[] { firstStreamIn, secondStreamIn }, SaveFormat.Docx);
LoadOptions firstLoadOptions = new LoadOptions() { IgnoreOleData = true };
LoadOptions secondLoadOptions = new LoadOptions() { IgnoreOleData = false };
using (FileStream streamOut = new FileStream(ArtifactsDir + "LowCode.MergeStreamDocument.3.docx", FileMode.Create, FileAccess.ReadWrite))
Merger.Merge(streamOut, new[] { firstStreamIn, secondStreamIn }, new[] { firstLoadOptions, secondLoadOptions }, saveOptions, MergeFormatMode.KeepSourceFormatting);
Document firstDoc = Merger.Merge(new[] { firstStreamIn, secondStreamIn }, MergeFormatMode.MergeFormatting);
firstDoc.Save(ArtifactsDir + "LowCode.MergeStreamDocument.4.docx");
Document secondDoc = Merger.Merge(new[] { firstStreamIn, secondStreamIn }, new[] { firstLoadOptions, secondLoadOptions }, MergeFormatMode.MergeFormatting);
secondDoc.Save(ArtifactsDir + "LowCode.MergeStreamDocument.5.docx");
}
}
Смотрите также
- class Document
- class LoadOptions
- enum MergeFormatMode
- class Merger
- пространство имен Aspose.Words.LowCode
- сборка Aspose.Words