Update 20240723
This commit is contained in:
@@ -30,6 +30,7 @@ using Syncfusion.XlsIO.Implementation.TemplateMarkers;
|
||||
using System.Drawing.Printing;
|
||||
|
||||
|
||||
|
||||
namespace DOCGEN.Klassen
|
||||
{
|
||||
public class SynFWord
|
||||
@@ -432,39 +433,39 @@ namespace DOCGEN.Klassen
|
||||
/// <summary>Word to PDF-Konverter</summary>
|
||||
/// <remarks>Das sind die Remarks</remarks>
|
||||
/// <param name="dokument">Base64-Dokument</param>
|
||||
//public string DocToPDF(string dokument)
|
||||
//{
|
||||
// MemoryStream ms = new MemoryStream(Helper.EncodeExtensions.DecodeBase642ByteArray(dokument));
|
||||
// WordDocument document = new WordDocument(ms, FormatType.Automatic);
|
||||
public string DocToPDF(string dokument)
|
||||
{
|
||||
MemoryStream ms = new MemoryStream(Helper.EncodeExtensions.DecodeBase642ByteArray(dokument));
|
||||
WordDocument document = new WordDocument(ms, FormatType.Automatic);
|
||||
|
||||
// int i = 0;
|
||||
// //Iterate each section from Word document
|
||||
// foreach (WSection section in document.Sections)
|
||||
// {
|
||||
// //Create new Word document
|
||||
// WordDocument newDocument = new WordDocument();
|
||||
// //Add cloned section into new Word document
|
||||
// newDocument.Sections.Add(section.Clone());
|
||||
// //Saves the Word document to MemoryStream
|
||||
// FileStream outputStream = new FileStream(@"x:\T1.totm", FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
||||
// newDocument.Save(outputStream, FormatType.Dotm);
|
||||
// document.Sections.RemoveAt(i);
|
||||
// FileStream outputStream1 = new FileStream(@"x:\T2.dotm", FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
||||
// document.Save(outputStream1, FormatType.Dotm);
|
||||
|
||||
// newDocument.Close();
|
||||
// document.Close();
|
||||
// outputStream.Close();
|
||||
// outputStream1.Close();
|
||||
// i++;
|
||||
// }
|
||||
// return "";
|
||||
|
||||
int i = 0;
|
||||
//Iterate each section from Word document
|
||||
foreach (WSection section in document.Sections)
|
||||
{
|
||||
//Create new Word document
|
||||
WordDocument newDocument = new WordDocument();
|
||||
//Add cloned section into new Word document
|
||||
newDocument.Sections.Add(section.Clone());
|
||||
//Saves the Word document to MemoryStream
|
||||
FileStream outputStream = new FileStream(@"x:\T1.dotm", FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
||||
newDocument.Save(outputStream, FormatType.Dotm);
|
||||
document.Sections.RemoveAt(i);
|
||||
FileStream outputStream1 = new FileStream(@"x:\T2.dotm", FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
||||
document.Save(outputStream1, FormatType.Dotm);
|
||||
|
||||
// //int cnt = document.Sections.Count;
|
||||
// //TextSelection textSelection = document.Find("Exemplar für", false, true);
|
||||
// //return dokument;
|
||||
//}
|
||||
newDocument.Close();
|
||||
document.Close();
|
||||
outputStream.Close();
|
||||
outputStream1.Close();
|
||||
i++;
|
||||
}
|
||||
return "";
|
||||
|
||||
|
||||
//int cnt = document.Sections.Count;
|
||||
//TextSelection textSelection = document.Find("Exemplar für", false, true);
|
||||
//return dokument;
|
||||
}
|
||||
|
||||
public int GetPageNumber(string text, WordDocument wd)
|
||||
{
|
||||
@@ -501,9 +502,30 @@ namespace DOCGEN.Klassen
|
||||
{
|
||||
MemoryStream ms = new MemoryStream(Helper.EncodeExtensions.DecodeBase642ByteArray(dokument));
|
||||
WordDocument document = new WordDocument(ms, FormatType.Automatic);
|
||||
var images = document.RenderAsImages(ImageType.Metafile);
|
||||
}
|
||||
document.UpdateDocumentFields();
|
||||
int i = 0;
|
||||
//Iterate each section from Word document
|
||||
foreach (WSection section in document.Sections)
|
||||
{
|
||||
//Create new Word document
|
||||
WordDocument newDocument = new WordDocument();
|
||||
//Add cloned section into new Word document
|
||||
newDocument.Sections.Add(section.Clone());
|
||||
//Saves the Word document to MemoryStream
|
||||
FileStream outputStream = new FileStream(@"x:\T1.dotm", FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
||||
newDocument.Save(outputStream, FormatType.Dotm);
|
||||
document.Sections.RemoveAt(i);
|
||||
FileStream outputStream1 = new FileStream(@"x:\T2.dotm", FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
||||
document.Save(outputStream1, FormatType.Dotm);
|
||||
|
||||
newDocument.Close();
|
||||
document.Close();
|
||||
outputStream.Close();
|
||||
outputStream1.Close();
|
||||
i++;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user