public static void DefineTableOfContents(Document document) { Section section = document.LastSection; section.AddPageBreak(); Paragraph paragraph = section.AddParagraph("Table of Contents"); paragraph.Format.Font.Size = 14; paragraph.Format.Font.Bold = true; paragraph.Format.SpaceAfter = 24; paragraph.Format.OutlineLevel = OutlineLevel.Level1; paragraph = section.AddParagraph(); paragraph.Style = "TOC"; Hyperlink hyperlink = paragraph.AddHyperlink("Paragraphs"); hyperlink.AddText("Paragraphs\t"); hyperlink.AddPageRefField("Paragraphs"); paragraph = section.AddParagraph(); paragraph.Style = "TOC"; hyperlink = paragraph.AddHyperlink("Tables"); hyperlink.AddText("Tables\t"); hyperlink.AddPageRefField("Tables"); paragraph = section.AddParagraph(); paragraph.Style = "TOC"; hyperlink = paragraph.AddHyperlink("Charts"); hyperlink.AddText("Charts\t"); hyperlink.AddPageRefField("Charts"); }
/// <summary> /// Default constructor /// </summary> /// <param name="result">LearnResult - learning result</param> /// <param name="chartFilename">string - char filename</param> /// <param name="includeDataTable">bool - true id learning data should be included</param> public HistoryPDF(LearnByErrorLibrary.LearnResult result, String chartFilename, bool includeDataTable = false) { this.result = result; this.chartFilename = chartFilename; document = new Document(); document.Info.Title = "NBN C# - wynik uczenia sieci neuronowej"; document.Info.Subject = "Uczenie sieci neuronowej za pomocą algorytmu NBN C#"; document.Info.Author = "Marek Bar 33808"; document.Info.Comment = "...ponieważ tylko dobry kod się liczy."; document.Info.Keywords = "C#, NBN, neuron, uczenie, sieć, nbn c#"; DefineStyles(document); DefineCover(document); DefineInfo(document, result); DefineChartArea(document, chartFilename, Path.GetFileNameWithoutExtension(result.Filename)); DefineWeightsSection(document, result); if (includeDataTable) { MatrixMB mat = MatrixMB.Load(result.Filename); AddMatrixTable(document, mat); } Section section = document.LastSection; section.AddPageBreak();//index of pages Paragraph paragraph = section.AddParagraph("Spis treści"); paragraph.Format.Font.Size = 14; paragraph.Format.Font.Bold = true; paragraph.Format.SpaceAfter = 24; paragraph.Format.OutlineLevel = OutlineLevel.Level1; paragraph = section.AddParagraph(); paragraph.Style = "TOC"; //first link Hyperlink hyperlink = paragraph.AddHyperlink("Informacje na temat sieci neuronowej"); hyperlink.AddText("\r\n" + "Informacje na temat sieci neuronowej" + "\t"); hyperlink.AddPageRefField("Informacje na temat sieci neuronowej"); hyperlink = paragraph.AddHyperlink("Wykres przebiegu uczenia"); hyperlink.AddText("\r\n" + "Wykres przebiegu uczenia" + "\t"); hyperlink.AddPageRefField("Wykres przebiegu uczenia"); hyperlink = paragraph.AddHyperlink("Wagi otrzymane w procesie uczenia"); hyperlink.AddText("\r\n" + "Wagi otrzymane w procesie uczenia" + "\t"); hyperlink.AddPageRefField("Wagi otrzymane w procesie uczenia"); if (includeDataTable) { hyperlink = paragraph.AddHyperlink("Dane wejściowe"); hyperlink.AddText("\r\n" + "Dane wejściowe" + "\t"); hyperlink.AddPageRefField("Dane wejściowe"); } }
/// <summary> /// Builds a table of contents, based on the content /// </summary> /// <param name="doc">The document to define for</param> /// <param name="contents">The content</param> private void DefineTableOfContents(Document doc, IEnumerable <FaseType> contents) { Section sect = doc.LastSection; sect.AddPageBreak(); Paragraph p = sect.AddParagraph("Inhoudsopgave", "Heading1"); p.Format.SpaceAfter = 24; p.Format.OutlineLevel = OutlineLevel.Level1; foreach (FaseType ft in contents) { Paragraph p2 = sect.AddParagraph(); p2.Style = "TOC"; if (ft.Type != null) { Hyperlink hyperlink = p2.AddHyperlink(ft.Type); hyperlink.AddText(ft.Type + "\t"); hyperlink.AddPageRefField(ft.Type); } else { p2.AddFormattedText("Critical data incomplete", "error"); } } }
/// <summary> /// Builds a table of contents, based on the content /// </summary> /// <param name="doc">The document to define for</param> /// <param name="contents">The content</param> private void DefineTableOfContents(Document doc, IEnumerable <Module> contents) { Section sect = doc.LastSection; sect.AddPageBreak(); Paragraph p = sect.AddParagraph("Inhoudsopgave", "Heading1"); p.Format.SpaceAfter = 24; p.Format.OutlineLevel = OutlineLevel.Level1; foreach (Module m in contents) { Paragraph p2 = sect.AddParagraph(); p2.Style = "TOC"; if (m.Naam != null && m.Schooljaar != null) { Hyperlink hyperlink = p2.AddHyperlink(m.Naam + " - " + m.Schooljaar); hyperlink.AddText(m.Naam + "\t"); hyperlink.AddPageRefField(m.Naam + " - " + m.Schooljaar); } else { p2.AddFormattedText("Critical data incomplete", "error"); } } }
private void DefineTableOfContentsProvinces(Document document) { Section section = document.LastSection; section.AddPageBreak(); Paragraph paragraph = section.AddParagraph("Table of Contents"); paragraph.Format.Font.Size = 14; paragraph.Format.Font.Bold = true; paragraph.Format.SpaceAfter = 24; paragraph.Format.OutlineLevel = OutlineLevel.Level1; paragraph = section.AddParagraph(); paragraph.Style = "TOC"; Hyperlink hyperlink = paragraph.AddHyperlink("All Provinces"); hyperlink.AddText("All Provinces\t"); hyperlink.AddPageRefField("All Provinces"); paragraph = section.AddParagraph(); paragraph.Style = "TOC"; hyperlink = paragraph.AddHyperlink("Provinces"); hyperlink.AddText("Provinces\t"); hyperlink.AddPageRefField("Provinces"); paragraph = section.AddParagraph(); paragraph.Style = "TOC"; hyperlink = paragraph.AddHyperlink("Province"); hyperlink.AddText("Province\t"); hyperlink.AddPageRefField("Province"); paragraph = section.AddParagraph(); paragraph.Style = "TOC"; hyperlink = paragraph.AddHyperlink("Male Players"); hyperlink.AddText("Male Players\t"); hyperlink.AddPageRefField("Male Players"); paragraph = section.AddParagraph(); paragraph.Style = "TOC"; hyperlink = paragraph.AddHyperlink("Female Players"); hyperlink.AddText("Female Players\t"); hyperlink.AddPageRefField("Female Players"); paragraph = section.AddParagraph(); paragraph.Style = "TOC"; hyperlink = paragraph.AddHyperlink("Events"); hyperlink.AddText("Events\t"); hyperlink.AddPageRefField("Events"); paragraph = section.AddParagraph(); paragraph.Style = "TOC"; hyperlink = paragraph.AddHyperlink("Charts"); hyperlink.AddText("Charts\t"); hyperlink.AddPageRefField("Charts"); }
public static void DefineTableOfContents(FinalDocument model) { if (!model.TOC) { return; } Section section = model.Document.AddSection(); section.PageSetup.LeftMargin = 40; section.PageSetup.RightMargin = 40; section.AddPageBreak(); Paragraph paragraph = section.AddParagraph("Contents"); paragraph.Format.Font.Size = 20; paragraph.Format.Font.Bold = true; paragraph.Format.SpaceAfter = 24; paragraph.Format.OutlineLevel = OutlineLevel.Level1; paragraph.Format.SpaceAfter = "2cm"; // Main title model.MainTitle.ToList().ForEach(x => { paragraph = section.AddParagraph(); paragraph.Style = "TOC 1"; Hyperlink hyperlinkLvl1 = null; // Sub title x.SubTitle.ToList().ForEach(u => { if (hyperlinkLvl1 == null) { hyperlinkLvl1 = paragraph.AddHyperlink(u.Id); hyperlinkLvl1.AddText($"{x.Title}\t"); hyperlinkLvl1.AddPageRefField(u.Id); paragraph.Format.SpaceAfter = "0.25cm"; } paragraph = section.AddParagraph(); paragraph.Style = "TOC 2"; Hyperlink hyperlinkLvl2 = paragraph.AddHyperlink(u.Id); hyperlinkLvl2.AddText($"{(char)160}{(char)160}{(char)160}{(char)160}{u.Title}\t"); hyperlinkLvl2.AddPageRefField(u.Id); }); paragraph.Format.SpaceAfter = "1cm"; }); }
/// <summary> /// Export name to a section in a document /// </summary> /// <param name="toExport">The data to export from</param> /// <param name="sect">The section to write on</param> /// <returns>The section with appended data</returns> public override Section Export(Leerlijn toExport, Section sect) { base.Export(toExport, sect); //custom code Paragraph p = sect.AddParagraph("Modules in deze leerlijn", "Heading2"); p.AddLineBreak(); p = sect.AddParagraph(); p.AddFormattedText("De leerlijnen zijn klikbaar in PDF viewers").Font.Color = Colors.DarkGray; p.AddLineBreak(); p.AddLineBreak(); foreach (Module m in toExport.Module) { p.AddFormattedText((m.Naam ?? "Data niet gevonden")).Font.Bold = true; p.AddLineBreak(); p.AddFormattedText("Komt ook voor in:").Font.Color = Colors.DarkGray; p.AddLineBreak(); List <Leerlijn> otherLines = m.Leerlijn.ToList(); foreach (Leerlijn l in otherLines) { if (!l.Naam.Equals(toExport.Naam)) { p.AddTab(); Hyperlink hyperlink = p.AddHyperlink((l.Naam ?? "Data niet gevonden")); hyperlink.AddText((l.Naam ?? "Data niet gevonden") + ", zie ook pagina "); hyperlink.AddPageRefField((l.Naam ?? "Data niet gevonden")); hyperlink.Font.Underline = Underline.Single; p.AddLineBreak(); } } p.AddLineBreak(); } return(sect); }
public static Document CreateDocument() { // Create a new MigraDoc document Document document = new Document(); document.Info.Title = " list NOTE"; document.Info.Subject = " generated file of all list notes"; document.Info.Author = "Data Migration Lange"; DefineStyles(document); DefineCover(document); Section section = document.LastSection; section.AddPageBreak(); Paragraph paragraph = section.AddParagraph("Table of Contents"); paragraph.Format.Font.Size = 14; paragraph.Format.Font.Bold = true; paragraph.Format.SpaceAfter = 24; paragraph.Format.OutlineLevel = OutlineLevel.Level1; //loop for each item { paragraph = section.AddParagraph(); paragraph.Style = "TOC"; Hyperlink hyperlink = paragraph.AddHyperlink("Table Overview"); hyperlink.AddText("Table Overview\t"); hyperlink.AddPageRefField("Table Overview"); } DefineContentSection(document); //for each item do this Paragraph paragraph_S = document.LastSection.AddParagraph("Table Overview", "Heading1"); paragraph_S.AddBookmark("Table Overview"); Table table = new Table(); table.Borders.Width = 0.75; Column column = table.AddColumn("16cm"); column.Format.Alignment = ParagraphAlignment.Left; //column = table.AddColumn(); //column.Format.Alignment = ParagraphAlignment.Left; Row row = table.AddRow(); //row.Shading.Color = Colors.PaleGoldenrod; //Cell cell = row.Cells[0]; //cell.Style = "BOLD"; //cell.AddParagraph("Itemus"); //cell.Style = "NOR"; //cell.AddParagraph("sdfsdf sdfsdf sdfsdf ssdfsdfsdf"); paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText("hello", TextFormat.Bold); paragraph.AddFormattedText(" by ", TextFormat.Italic); paragraph.AddLineBreak(); paragraph.AddText("XXXXX "); row = table.AddRow(); paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText("hellosdf", TextFormat.Bold); paragraph.AddFormattedText(" by ssdfds", TextFormat.Italic); paragraph.AddText("XXXXXsdf sdfdsf "); table.SetEdge(0, 0, 1, table.Rows.Count, Edge.Box, BorderStyle.Single, 1.5, Colors.Black); document.LastSection.Add(table); section.AddPageBreak(); return(document); }
public static Document CreateDocument() { // Create a new MigraDoc document Document document = new Document(); document.Info.Title = "SAMPLE TITLE NOTE"; document.Info.Subject = "Auto generated file of all list of items notes"; document.Info.Author = "Data Migration "; DefineStyles(document); DefineCover(document); Section section = document.LastSection; section.AddPageBreak(); Paragraph paragraph = section.AddParagraph("Table of Contents"); paragraph.Format.Font.Size = 14; paragraph.Format.Font.Bold = true; paragraph.Format.SpaceAfter = 24; paragraph.Format.OutlineLevel = OutlineLevel.Level1; var list = new List <LogEntry>() { new LogEntry() { LogId = 1, Desc = "sdfsdfsd sdf", Summary = "lorem sdfds sdfs dfds", CreatedOn = DateTime.Now }, new LogEntry() { LogId = 2, Desc = "XXXX XXXX", Summary = "SSSSS SSSSdfds sdSS SSS fs dfds" } }; foreach (var i in list) //loop for each item { paragraph = section.AddParagraph(); paragraph.Style = "TOC"; Hyperlink hyperlink = paragraph.AddHyperlink(i.LogId.ToString()); hyperlink.AddText(i.Desc + "\t"); hyperlink.AddPageRefField(i.LogId.ToString()); } DefineContentSection(document); foreach (var i in list) //loop for each item { //for each item do this Paragraph paragraph_S = document.LastSection.AddParagraph(i.Desc, "Heading1"); paragraph_S.AddBookmark(i.LogId.ToString()); Table table = new Table(); table.Borders.Width = 0.75; Column column = table.AddColumn("16cm"); column.Format.Alignment = ParagraphAlignment.Left; Row row = table.AddRow(); paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText("hello", TextFormat.Bold); paragraph.AddFormattedText(" by ", TextFormat.Italic); paragraph.AddLineBreak(); paragraph.AddText("XXXXX "); row = table.AddRow(); paragraph = row.Cells[0].AddParagraph(); paragraph.AddFormattedText("hellosdf", TextFormat.Bold); paragraph.AddFormattedText(" by ssdfds", TextFormat.Italic); paragraph.AddText(i.CreatedOn?.ToString("MM/dd/yyyy h:mm tt") ?? ""); table.SetEdge(0, 0, 1, table.Rows.Count, Edge.Box, BorderStyle.Single, 1.5, Colors.Black); document.LastSection.Add(table); } return(document); }