1
나는 C#으로 단어 문서를 만드는 데 Novacode Docx를 사용하고 있지만 두 문서를 하나로 병합하는 데 문제가 있습니다. 제 요구 사항에 따라 두 단어 문서를 한 번에 압축하지 않고 다운로드해야합니다. 그러나 나는 해결책을 찾지 못했습니다. 그래서 나는 단어 문서를 병합하여 하나의 파일로 다운로드 할 계획이었습니다. 어떤 사람이 Novacode Docx를 사용하여 단어 문서를 병합하는 방법을 알려줄 수 있습니까?Novacode Docx 여러 단어 문서를 병합
미리 감사드립니다.
private DocX fullReportDocument;
private DocX titleDocument;
private DocX firstDocument;
private DocX secondDocument;
public byte[] GetReport(bool WantFirstReport, bool WantSecondReport)
{
fullDocument = DocX.Create(new MemoryStream());
// Create title for the report
this.GenerateTitleDocument();
// Insert the old document into the new document.
fullDocument.InsertDocument(titleDocument);
// Save the new document.
fullDocument.Save();
if (WantFirstReport)
{
// Create expertise report
this.GenrateFirstDocument();
// Insert a page break at the beginning to separate title and expertise report properly
firstDocument.Paragraphs[0].InsertPageBreakBeforeSelf();
firstDocument.Save();
// Insert the old document into the new document.
fullDocument.InsertDocument(firstDocument);
// Save the new document.
fullDocument.Save();
}
if (WantSecondReport)
{
// Create expertise report
this.GenrateSecondDocument();
// Insert a page break at the beginning to separate title and expertise report properly
secondDocument.Paragraphs[0].InsertPageBreakBeforeSelf();
secondDocument.Save();
// Insert the old document into the new document.
fullDocument.InsertDocument(secondDocument);
// Save the new document.
fullDocument.Save();
}
return fullReportDocument.DocumentMemoryStream.ToArray();
}
하지만 난 당신도 할 수있는 DOCX 라이브러리를 수정 싶지 않는 경우 MemoryStream을 내부 MemoryStream을
를 노출 DocumentMemoryStream 속성을 추가 할 DOCX의 librairy 수정 :