当前位置: 首页>>代码示例>>C#>>正文


C# Document.AddSection方法代码示例

本文整理汇总了C#中MigraDoc.DocumentObjectModel.Document.AddSection方法的典型用法代码示例。如果您正苦于以下问题:C# Document.AddSection方法的具体用法?C# Document.AddSection怎么用?C# Document.AddSection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MigraDoc.DocumentObjectModel.Document的用法示例。


在下文中一共展示了Document.AddSection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DefineContentSection

    /// <summary>
    /// Defines page setup, headers, and footers.
    /// </summary>
    static void DefineContentSection(Document document, Project currentProject)
    {
    	try {
    	  Section section = document.AddSection();
	      section.PageSetup.OddAndEvenPagesHeaderFooter = true;
	      section.PageSetup.StartingNumber = 1;
	
	      HeaderFooter header = section.Headers.Primary;
	      header.AddParagraph(currentProject.Name);
	      
	      header = section.Headers.EvenPage;
	      header.AddParagraph(currentProject.Name);
	
	      // Create a paragraph with centered page number. See definition of style "Footer".
	      Paragraph paragraph = new Paragraph();
	      paragraph.AddTab();
	      paragraph.AddPageField();
	
	      // Add paragraph to footer for odd pages.
	      section.Footers.Primary.Add(paragraph);
	      // Add clone of paragraph to footer for odd pages. Cloning is necessary because an object must
	      // not belong to more than one other object. If you forget cloning an exception is thrown.
	      section.Footers.EvenPage.Add(paragraph.Clone());
    	} catch (Exception ex) {
    		throw ex;
    	}
     
    }
开发者ID:jiashida,项目名称:cameratrapmanager,代码行数:31,代码来源:Documents.cs

示例2: SetDocument

        private void SetDocument(ref Document document, Order order)
        {
            var tableColor = new Color(0, 0, 0, 0);
            Section section = document.AddSection();

            //HEADER
            SetHeader(ref section);

            //FOOTER
            SetFooter(ref section);

            //INFO
            SetInfo(order, ref section);

            //TABLE STYLE
            Table table = SetTableStyle(ref section, tableColor);

            //HEADERS
            SetTableHeader(ref table, tableColor);

            //ITEMS
            SetTableData(order, ref table);

            //SUMMARY
            SetTableSummary(order, ref table);
        }
开发者ID:neozhu,项目名称:Ecommerce,代码行数:26,代码来源:OrderInvoiceService.cs

示例3: Run

        void Run()
        {
            if (File.Exists(outputName))
            {
                File.Delete(outputName);
            }

            var doc = new Document();
            doc.DefaultPageSetup.Orientation = Orientation.Portrait;
            doc.DefaultPageSetup.PageFormat = PageFormat.A4;
            //doc.DefaultPageSetup.LeftMargin = Unit.FromMillimeter(5.0);
            //doc.DefaultPageSetup.RightMargin = Unit.FromMillimeter(5.0);
            //doc.DefaultPageSetup.BottomMargin = Unit.FromMillimeter(5.0);
            //doc.DefaultPageSetup.TopMargin = Unit.FromMillimeter(5.0);
            StyleDoc(doc);
            var section = doc.AddSection();
            var footer = new TextFrame();

            section.Footers.Primary.Add(footer);
            var html = File.ReadAllText("example.html");
            section.AddHtml(html);

            var renderer = new PdfDocumentRenderer();
            renderer.Document = doc;
            renderer.RenderDocument();

            renderer.Save(outputName);
            Process.Start(outputName);
        }
开发者ID:jgshumate1,项目名称:MigraDoc.Extensions,代码行数:29,代码来源:Program.cs

示例4: DefineCover

    /// <summary>
    /// Defines the cover page.
    /// </summary>
    public static void DefineCover(Document document, Project currentProject)
    {
    	try {
    		Section section = document.AddSection();

		    Paragraph paragraph = section.AddParagraph();
		    paragraph.Format.SpaceAfter = "3cm";
				    
		    Image image = section.AddImage(System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().Location)[email protected]"\\logo.jpg");
		    image.Width = "6cm";
		
		    paragraph = section.AddParagraph("Report generated using Cameratrap Manager\nfor the project:\n"+currentProject.Name);
		    paragraph.Format.Font.Size = 16;
		    paragraph.Format.Font.Color = Colors.DarkRed;
		    paragraph.Format.SpaceBefore = "6cm";
		    paragraph.Format.SpaceAfter = "3cm";
		
		    paragraph=section.AddParagraph("Creation date: " + currentProject.StartDate.ToString());
		    paragraph=section.AddParagraph("Last modified: " + currentProject.CompletionDate.ToString());
		      
		    paragraph = section.AddParagraph("Rendering date: ");
		    paragraph.AddDateField();
    	} catch (Exception ex) {
    		throw ex;
    	}
    	
     
    }
开发者ID:jiashida,项目名称:cameratrapmanager,代码行数:31,代码来源:Cover.cs

示例5: Alignment

        /// <summary>
        /// Tests alignments.
        /// </summary>
        public static void Alignment(string pdfOutputFile)
        {
            Document document = new Document();
            Section section = document.AddSection();
            section.PageSetup.LeftMargin = 0;
            section.PageSetup.RightMargin = 0;
            Paragraph par = section.AddParagraph();
            //      FillFormattedParagraph(par);
            //      par.Format.Alignment = ParagraphAlignment.Left;

            //      par = section.AddParagraph();
            //      FillFormattedParagraph(par);
            //      par.Format.Alignment = ParagraphAlignment.Right;

            //      par = section.AddParagraph();
            FillFormattedParagraph(par);
            par.Format.Alignment = ParagraphAlignment.Center;
            //
            //      par = section.AddParagraph();
            //      FillFormattedParagraph(par);
            //      par.Format.Alignment = ParagraphAlignment.Justify;

            par.Format.FirstLineIndent = "-2cm";
            par.Format.LeftIndent = "2cm";
            par.Format.RightIndent = "3cm";
            PdfDocumentRenderer renderer = new PdfDocumentRenderer();
            renderer.Document = document;
            renderer.RenderDocument();
            renderer.PdfDocument.Save(pdfOutputFile);
        }
开发者ID:Sl0vi,项目名称:MigraDoc,代码行数:33,代码来源:TestParagraphRenderer.cs

示例6: Convert

        public Boolean Convert(String inputFileName, String outputFileName)
        {
            try
            {
                var text = File.ReadAllText(inputFileName);

                // Create a MigraDoc document
                Document document = new Document();
                var section = document.AddSection();
                var paragraph = section.AddParagraph();
                paragraph.Format.Font.Size = 12;
                paragraph.AddFormattedText(text);


                PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(unicode, embedding);
                pdfRenderer.Document = document;
                pdfRenderer.RenderDocument();
                pdfRenderer.PdfDocument.Save(outputFileName);
                return true;
            }
            catch (Exception ex)
            {
                Logger.WarnFormat(ex, "Error converting file {0} to Pdf.", inputFileName);
                return false;
            }
        }
开发者ID:ProximoSrl,项目名称:Jarvis.DocumentStore,代码行数:26,代码来源:TextPdfConverter.cs

示例7: ReportTools

        /// <summary>
        /// Constructor
        /// </summary>
        /// <param name="doc"></param>
        public ReportTools(Document doc)
        {
            document = doc;
            DefineStyles(document);

            section = document.AddSection();
        }
开发者ID:Assmann-Siemens,项目名称:ERTMSFormalSpecs,代码行数:11,代码来源:ReportTools.cs

示例8: CreateSample1

    /// <summary>
    /// Creates the initial sample document.
    /// </summary>
    public static Document CreateSample1()
    {
      // Create a new MigraDoc document
      Document document = new Document();

      // Add a section to the document
      Section section = document.AddSection();

      // Add a paragraph to the section
      Paragraph paragraph = section.AddParagraph();

      // Add some text to the paragraph
      paragraph.AddFormattedText("Hi!");

      paragraph = section.AddParagraph();
      paragraph.AddText("This is a MigraDoc document created for the DocumentViewer sample application.");
      paragraph.AddText("The DocumentViewer demonstrates all techniques you need to preview and print a MigraDoc document, and convert it to a PDF, RTF, or image file.");

      section.AddParagraph();
      section.AddParagraph();
      paragraph = section.AddParagraph("A4 portrait");
      paragraph.Format.Font.Size = "1.5cm";

      section.AddPageBreak();
      section.AddParagraph().AddText("Page 2");

      section = document.AddSection();
      section.PageSetup.Orientation = Orientation.Landscape;

      paragraph = section.AddParagraph("A4 landscape");
      paragraph.Format.Font.Size = "1.5cm";

      section.AddPageBreak();
      section.AddParagraph().AddText("Page 4");

      section = document.AddSection();
      section.PageSetup.Orientation = Orientation.Portrait;
      section.PageSetup.PageFormat = PageFormat.A5;

      paragraph = section.AddParagraph("A5 portrait");
      paragraph.Format.Font.Size = "1.5cm";

      section.AddPageBreak();
      section.AddParagraph().AddText("Page 6");

      return document;
    }
开发者ID:vronikp,项目名称:EventRegistration,代码行数:50,代码来源:SampleDocuments.cs

示例9: SingleRecipePDF

 /// <summary>
 /// Create a pdf file of a single recipe
 /// </summary>
 /// <param name="recipe">Recipe Entry</param>
 /// <param name="filename">string of save location</param>
 /// <param name="preview">bool</param>
 public static void SingleRecipePDF(RecipeEntry recipe, string filename, bool preview)
 {
     Document file = new Document();
     file.Info.Title = recipe.Name;
     Section section = file.AddSection();
     DrawRecipe(recipe, ref section);
     SavePDF(file, filename, preview);
 }
开发者ID:winkert,项目名称:RecipeBook,代码行数:14,代码来源:PDFPrinter.cs

示例10: InitDocument

    protected void InitDocument()
    {
      Document = new Document();

      CurrentSection = Document.AddSection();
      CurrentSection.PageSetup.PageFormat = PageFormat.A4;
      CurrentSection.PageSetup.TopMargin = Unit.FromMillimeter(10);
      CurrentSection.PageSetup.LeftMargin = Unit.FromMillimeter(10);
      CurrentSection.PageSetup.RightMargin = Unit.FromMillimeter(10);
      CurrentSection.PageSetup.BottomMargin = Unit.FromMillimeter(10);
    }
开发者ID:GorelH,项目名称:PdfSharp,代码行数:11,代码来源:BaseDocument.cs

示例11: Formatted

 /// <summary>
 /// Tests AddFormattedText.
 /// </summary>
 public static void Formatted(string pdfOutputFile)
 {
     Document document = new Document();
     Section section = document.AddSection();
     Paragraph par = section.AddParagraph();
     FillFormattedParagraph(par);
     PdfDocumentRenderer printer = new PdfDocumentRenderer();
     printer.Document = document;
     printer.RenderDocument();
     printer.PdfDocument.Save(pdfOutputFile);
 }
开发者ID:Sl0vi,项目名称:MigraDoc,代码行数:14,代码来源:TestParagraphRenderer.cs

示例12: PDFDocumentBuilder

 public PDFDocumentBuilder()
 {
     document = new Document();
     const bool unicode = true;
     pdfRenderer = new PdfDocumentRenderer(unicode);
     document.Info.Title = "Search results";
     document.Info.Author = "Zajęcia projektowe z TO grupa 9:30 Wtorek";
     DefineStyles(document);
     pdfRenderer.Document = document;
     section = document.AddSection();
 }
开发者ID:kzemek,项目名称:FileScanner,代码行数:11,代码来源:PDFDocumentBuilder.cs

示例13: CreateDocument

        Document CreateDocument()
        {
            // Create a new MigraDoc document
            Document document = new Document();

            // Add a section to the document
            Section section = document.AddSection();

            // Add a paragraph to the section
            Paragraph paragraph = section.AddParagraph();

            // Add some text to the paragraph
            paragraph.AddImage(Application.StartupPath + "\\images\\logo.png");
            paragraph.AddFormattedText("Braze number: " + textBox1.Text + "\n", TextFormat.Bold);
            paragraph.AddFormattedText("Date: " + textBox2.Text + "\n", TextFormat.NotBold);
            paragraph.AddFormattedText("Duration: " + textBox3.Text + "\n", TextFormat.NotBold);
            paragraph.AddFormattedText("Status: " + textBox5.Text + "\n\n", TextFormat.NotBold);
            paragraph.AddFormattedText("Log: " +"\n", TextFormat.Bold);
            int loCount = 0;
            for (int i = 0; i < listView1.Items.Count; i++)
            {
                if (listView1.Items[i].Text.Contains("The large Nitrogen valve is opened."))
                {
                    if (loCount < 2)
                    {
                        paragraph.AddFormattedText(listView1.Items[i].Text + "\n", TextFormat.NotBold);
                    }
                    loCount++;
                    if (loCount == 2)
                    {
                        paragraph.AddFormattedText("...\n", TextFormat.NotBold);
                    }
                }
                else if (listView1.Items[i].Text.Contains("The large Nitrogen valve is closed."))
                {
                    if (loCount < 2)
                    {
                        paragraph.AddFormattedText(listView1.Items[i].Text + "\n", TextFormat.NotBold);
                    }

                }
                else
                {
                    paragraph.AddFormattedText(listView1.Items[i].Text + "\n", TextFormat.NotBold);
                }
            }
            //paragraph.AddImage("../../SomeImage.png");
            //paragraph.AddImage("../../Logo.pdf");
            //section.AddImage("../../Logo.pdf");
            section.AddImage(Application.StartupPath + "\\temp\\testa.png");
            section.AddImage(Application.StartupPath + "\\temp\\testb.png");

            return document;
        }
开发者ID:Kantaris,项目名称:vacuum-furnace-control-application,代码行数:54,代码来源:History.cs

示例14: CreateHelloWorld

        private static Document CreateHelloWorld()
        {
            var doc = new Document();
            var section = doc.AddSection();
            var p = section.AddParagraph("Hello World");
            p = section.AddParagraph();
            p.AddImage(System.IO.Path.Combine(Environment.CurrentDirectory, "Diagram.png"));

            DefineCharts(doc);

            return doc;
        }
开发者ID:DavidS,项目名称:MigraDoc,代码行数:12,代码来源:Form1.cs

示例15: Borders

        public static void Borders(string outputFile)
        {
            Document document = new Document();
              Section section = document.AddSection();
              Paragraph par = section.AddParagraph();
              FillFormattedParagraph(par);
              GiveBorders(par);

              PdfPrinter printer = new PdfPrinter();
              printer.Document = document;
              printer.PrintDocument();
              printer.PdfDocument.Save(outputFile);
        }
开发者ID:dankennedy,项目名称:MigraDoc,代码行数:13,代码来源:TestParagraphRenderer.cs


注:本文中的MigraDoc.DocumentObjectModel.Document.AddSection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。