public static void createTaskDocument(List <string> textForQRcode, string nameWorker, List <string> typeOfWork, List <string> infoAboutAuto, List <string> infoAboutDetails, List <DateTime> dateTimeStart, List <DateTime> dateTimeFinish)
{
// Create a document in memory:
var doc = DocX.Create("Task" + ".docx");
doc.PageLayout.Orientation = Novacode.Orientation.Landscape;
for (int i = 0; i < textForQRcode.Count(); i++)
{
var text = "Завдання \"" + typeOfWork[i] + "\"\n\n";
var format = new Formatting();
format.Size = 24D;
format.FontFamily = new System.Drawing.FontFamily("Times New Roman");
var format1 = new Formatting();
format1.Size = 20D;
format1.Bold = true;
format1.FontFamily = new System.Drawing.FontFamily("Times New Roman");
Paragraph title = doc.InsertParagraph(text, false, format);
title.Alignment = Alignment.center;
Novacode.Table table = doc.AddTable(1, 3);
table.Design = Novacode.TableDesign.TableNormal;
table.Alignment = Alignment.left;
using (var ms = new MemoryStream())
{
System.Drawing.Image qrCode = generateQR(textForQRcode[i]);
qrCode.Save(ms, System.Drawing.Imaging.ImageFormat.Bmp); // Save your picture in a memory stream.
ms.Seek(0, SeekOrigin.Begin);
Novacode.Image img = doc.AddImage(ms); // Create image.
Picture pic1 = img.CreatePicture(); // Create picture.
table.Rows[0].Cells[0].Paragraphs.First().InsertPicture(pic1, 0);
}
format.Size = 18D;
table.SetWidths(new float[] { 300, 200, 750 });
table.Rows[0].Cells[2].Paragraphs.First().InsertText("Автомобіль - ", false, format);
table.Rows[0].Cells[2].Paragraphs.First().InsertText(infoAboutAuto[i], false, format1);
table.Rows[0].Cells[2].InsertParagraph("Деталі : \n", false, format).InsertText(infoAboutDetails[i], false, format1);
table.Rows[0].Cells[2].InsertParagraph("Виконавець(по плану) - ", false, format).InsertText(nameWorker, false, format1);
table.Rows[0].Cells[2].InsertParagraph("Початок роботи - ", false, format).InsertText(dateTimeStart[i].ToString(), false, format1);
table.Rows[0].Cells[2].InsertParagraph("Кінець роботи - ", false, format).InsertText(dateTimeFinish[i].ToString(), false, format1);
doc.InsertTable(table);
if (textForQRcode.Count() - i > 1)
{
doc.InsertSectionPageBreak();
}
doc.PageLayout.Orientation = Novacode.Orientation.Landscape;
}
doc.Save();
ViewModels.ClassForAudio.playScan();
}