Bilder werdem erstellt
This commit is contained in:
@@ -81,6 +81,77 @@ namespace BerichtGen
|
||||
|
||||
wordDocument.MailMerge.Execute(fieldnames, fieldvalues);
|
||||
|
||||
IWParagraph iWParagraph = null;
|
||||
var x = wordDocument.Sections;
|
||||
|
||||
foreach(IWSection section in wordDocument.Sections)
|
||||
{
|
||||
IWParagraphCollection paragraphs = section.Paragraphs;
|
||||
|
||||
foreach(IWParagraph item2 in paragraphs)
|
||||
{
|
||||
|
||||
if (item2.Text.StartsWith("@WeitereBilder")) {
|
||||
iWParagraph = item2;
|
||||
if(bilderObjects.Count > 0)
|
||||
{
|
||||
//section.ChildEntities.Clear();
|
||||
iWParagraph.Text = "Weitere Bilder";
|
||||
iWParagraph.AppendBreak(BreakType.LineBreak);
|
||||
IWTable wTable = section.Body.AddTable();
|
||||
wTable.ResetCells(1, 2);
|
||||
wTable.TableFormat.IsAutoResized = true;
|
||||
wTable.TableFormat.IsBreakAcrossPages = false;
|
||||
wTable.TableFormat.Borders.BorderType = BorderStyle.Dot;
|
||||
WTableRow wTableRow = wTable.Rows[0];
|
||||
bool flag = false;
|
||||
int num = -1;
|
||||
foreach (BilderObject foto in bilderObjects)
|
||||
{
|
||||
if (num == -1)
|
||||
num++;
|
||||
|
||||
if (flag)
|
||||
{
|
||||
wTableRow = wTable.AddRow();
|
||||
flag = false;
|
||||
}
|
||||
int index = 1;
|
||||
if (num % 2 == 0)
|
||||
{
|
||||
index = 0;
|
||||
flag = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = true;
|
||||
}
|
||||
iWParagraph = wTableRow.Cells[index].AddParagraph();
|
||||
Image image2 = _listImages[num];
|
||||
if (image2 != null)
|
||||
{
|
||||
iWParagraph.AppendPicture(image2);
|
||||
if (foto != null)
|
||||
{
|
||||
iWParagraph.AppendBreak(BreakType.LineBreak);
|
||||
IWTextRange wTextRange = iWParagraph.AppendText(foto.Kommentar);
|
||||
wTextRange.CharacterFormat.FontName = "Arial";
|
||||
wTextRange.CharacterFormat.FontSize = 10f;
|
||||
}
|
||||
}
|
||||
num++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
iWParagraph.Text = "";
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(erzeugeDOC)
|
||||
wordDocument.Save(Path.Combine(savepath,string.Format("{0}.doc",filename)), Syncfusion.DocIO.FormatType.Doc);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user