コード例 #1
0
ファイル: TestTable.cs プロジェクト: LegendRiver/FBAW_Project
        public static void CellMerge(string outputFile)
        {
            Document document = new Document();
            Section  sec      = document.Sections.AddSection();

            sec.AddParagraph("A paragraph before.");
            Table table = sec.AddTable();

            table.Borders.Visible = true;
            table.AddColumn();
            table.AddColumn();
            Row  row  = table.AddRow();
            Cell cell = row.Cells[0];

            cell.MergeRight          = 1;
            cell.Borders.Visible     = true;
            cell.Borders.Left.Width  = 8;
            cell.Borders.Right.Width = 2;
            cell.AddParagraph("First Cell");

            row  = table.AddRow();
            cell = row.Cells[1];
            cell.AddParagraph("Last Cell within this row");
            cell.MergeDown            = 1;
            cell.Borders.Bottom.Width = 15;
            cell.Borders.Right.Width  = 30;
            cell.Shading.Color        = Colors.LightBlue;
            row = table.AddRow();
            sec.AddParagraph("A Paragraph afterwards");
            PdfPrinter printer = new PdfPrinter();

            printer.Document = document;
            printer.PrintDocument();
            printer.PdfDocument.Save(outputFile);
        }
コード例 #2
0
        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";
            PdfPrinter printer = new PdfPrinter();

            printer.Document = document;
            printer.PrintDocument();
            printer.PdfDocument.Save(pdfOutputFile);
        }
コード例 #3
0
ファイル: TestTable.cs プロジェクト: LegendRiver/FBAW_Project
        public static void VerticalAlign(string outputFile)
        {
            Document document = new Document();
            Section  sec      = document.Sections.AddSection();

            sec.AddParagraph("A paragraph before.");
            Table table = sec.AddTable();

            table.Borders.Visible = true;
            table.AddColumn();
            table.AddColumn();
            Row row = table.AddRow();

            row.HeightRule        = RowHeightRule.Exactly;
            row.Height            = 70;
            row.VerticalAlignment = VerticalAlignment.Center;
            row[0].AddParagraph("First Cell");
            row[1].AddParagraph("Second Cell");
            sec.AddParagraph("A Paragraph afterwards.");


            PdfPrinter printer = new PdfPrinter();

            printer.Document = document;
            printer.PrintDocument();
            printer.PdfDocument.Save(outputFile);
        }
コード例 #4
0
        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";
              PdfPrinter printer = new PdfPrinter();
              printer.Document = document;
              printer.PrintDocument();
              printer.PdfDocument.Save(pdfOutputFile);
        }
コード例 #5
0
ファイル: TestTable.cs プロジェクト: dankennedy/MigraDoc
        public static void CellMerge(string outputFile)
        {
            Document document = new Document();
              Section sec = document.Sections.AddSection();
              sec.AddParagraph("A paragraph before.");
              Table table = sec.AddTable();
              table.Borders.Visible = true;
              table.AddColumn();
              table.AddColumn();
              Row row = table.AddRow();
              Cell cell = row.Cells[0];
              cell.MergeRight = 1;
              cell.Borders.Visible = true;
              cell.Borders.Left.Width = 8;
              cell.Borders.Right.Width = 2;
              cell.AddParagraph("First Cell");

              row = table.AddRow();
              cell = row.Cells[1];
              cell.AddParagraph("Last Cell within this row");
              cell.MergeDown = 1;
              cell.Borders.Bottom.Width = 15;
              cell.Borders.Right.Width = 30;
              cell.Shading.Color = Colors.LightBlue;
              row = table.AddRow();
              sec.AddParagraph("A Paragraph afterwards");
              PdfPrinter printer = new PdfPrinter();
              printer.Document = document;
              printer.PrintDocument();
              printer.PdfDocument.Save(outputFile);
        }
コード例 #6
0
ファイル: TestLayout.cs プロジェクト: jgshumate1/Migradoc
        public static void TwoParagraphs(string outputFile)
        {
            Document doc = new Document();
            Section  sec = doc.Sections.AddSection();

            sec.PageSetup.TopMargin    = 0;
            sec.PageSetup.BottomMargin = 0;

            Paragraph par1 = sec.AddParagraph();

            TestParagraphRenderer.FillFormattedParagraph(par1);
            TestParagraphRenderer.GiveBorders(par1);
            par1.Format.SpaceAfter  = "2cm";
            par1.Format.SpaceBefore = "3cm";
            Paragraph par2 = sec.AddParagraph();

            TestParagraphRenderer.FillFormattedParagraph(par2);
            TestParagraphRenderer.GiveBorders(par2);
            par2.Format.SpaceBefore = "3cm";

            PdfPrinter printer = new PdfPrinter();

            printer.Document = doc;
            printer.PrintDocument();
            printer.PdfDocument.Save(outputFile);
        }
コード例 #7
0
 public static void Formatted(string pdfOutputFile)
 {
   Document document = new Document();
   Section section = document.AddSection();
   Paragraph par = section.AddParagraph();
   FillFormattedParagraph(par);
   PdfPrinter printer = new PdfPrinter();
   printer.Document = document;
   printer.PrintDocument();
   printer.PdfDocument.Save(pdfOutputFile);
 }
コード例 #8
0
        public static void Formatted(string pdfOutputFile)
        {
            Document  document = new Document();
            Section   section  = document.AddSection();
            Paragraph par      = section.AddParagraph();

            FillFormattedParagraph(par);
            PdfPrinter printer = new PdfPrinter();

            printer.Document = document;
            printer.PrintDocument();
            printer.PdfDocument.Save(pdfOutputFile);
        }
コード例 #9
0
        public static void Tabs(string pdfOutputFile)
        {
            Document document = new Document();
            Section  section  = document.AddSection();

            section.PageSetup.LeftMargin  = 0;
            section.PageSetup.RightMargin = 0;
            Paragraph par = section.AddParagraph();

            par.Format.TabStops.AddTabStop("20cm", TabAlignment.Right);
            par.AddText(" text before tab bla bla bla. text before tab bla bla bla. text before tab bla bla bla. text before tab bla bla bla.");
            //par.AddTab();
            par.AddText(" ............ after tab bla bla bla.");
            PdfPrinter printer = new PdfPrinter();

            printer.Document = document;
            printer.PrintDocument();
            printer.PdfDocument.Save(pdfOutputFile);
        }
コード例 #10
0
ファイル: Form1.cs プロジェクト: LegendRiver/FBAW_Project
 private void button12_Click(object sender, System.EventArgs e)
 {
     if (this.tbxDdlFile.Text != "")
     {
         try
         {
             Document   doc        = DdlReader.DocumentFromFile(tbxDdlFile.Text);
             PdfPrinter pdfPrinter = new PdfPrinter();
             pdfPrinter.Document = doc;
             pdfPrinter.PrintDocument();
             pdfPrinter.PdfDocument.Save("egal.pdf");
             System.Diagnostics.Process.Start("egal.pdf");
         }
         catch (Exception exc)
         {
             MessageBox.Show(exc.Message);
         }
     }
 }
コード例 #11
0
 public static void TextAndBlanks(string pdfOutputFile)
 {
   Document document = new Document();
   Section section = document.AddSection();
   Paragraph par = section.AddParagraph("Dies");
   for (int idx = 0; idx <= 40; ++idx)
   {
     par.AddCharacter(SymbolName.Blank);
     par.AddText(idx.ToString());
     par.AddCharacter(SymbolName.Blank);
     par.AddText((idx + 1).ToString());
     par.AddCharacter(SymbolName.Blank);
     par.AddText((idx + 2).ToString());
   }
   PdfPrinter printer = new PdfPrinter();
   printer.Document = document;
   printer.PrintDocument();
   printer.PdfDocument.Save(pdfOutputFile);
 }
コード例 #12
0
ファイル: TestLayout.cs プロジェクト: dankennedy/MigraDoc
        public static void A1000Paragraphs(string outputFile)
        {
            Document doc = new Document();
              Section sec = doc.Sections.AddSection();

              sec.PageSetup.TopMargin = 0;
              sec.PageSetup.BottomMargin = 0;

              for (int idx = 1; idx <= 1000; ++idx)
              {
            Paragraph par = sec.AddParagraph();
            par.AddText("Paragraph " + idx + ": ");
            TestParagraphRenderer.FillFormattedParagraph(par);
            TestParagraphRenderer.GiveBorders(par);
              }
              PdfPrinter printer = new PdfPrinter();
              printer.Document = doc;
              printer.PrintDocument();
              printer.PdfDocument.Save(outputFile);
        }
コード例 #13
0
ファイル: TestLayout.cs プロジェクト: jgshumate1/Migradoc
        public static void A1000Paragraphs(string outputFile)
        {
            Document doc = new Document();
            Section  sec = doc.Sections.AddSection();

            sec.PageSetup.TopMargin    = 0;
            sec.PageSetup.BottomMargin = 0;

            for (int idx = 1; idx <= 1000; ++idx)
            {
                Paragraph par = sec.AddParagraph();
                par.AddText("Paragraph " + idx + ": ");
                TestParagraphRenderer.FillFormattedParagraph(par);
                TestParagraphRenderer.GiveBorders(par);
            }
            PdfPrinter printer = new PdfPrinter();

            printer.Document = doc;
            printer.PrintDocument();
            printer.PdfDocument.Save(outputFile);
        }
コード例 #14
0
        public static void TextAndBlanks(string pdfOutputFile)
        {
            Document  document = new Document();
            Section   section  = document.AddSection();
            Paragraph par      = section.AddParagraph("Dies");

            for (int idx = 0; idx <= 40; ++idx)
            {
                par.AddCharacter(SymbolName.Blank);
                par.AddText(idx.ToString());
                par.AddCharacter(SymbolName.Blank);
                par.AddText((idx + 1).ToString());
                par.AddCharacter(SymbolName.Blank);
                par.AddText((idx + 2).ToString());
            }
            PdfPrinter printer = new PdfPrinter();

            printer.Document = document;
            printer.PrintDocument();
            printer.PdfDocument.Save(pdfOutputFile);
        }
コード例 #15
0
        public static void Fields(string outputFile)
        {
            Document  document = new Document();
            Section   section  = document.AddSection();
            Paragraph par      = section.AddParagraph();

            par.AddText("Section: ");
            par.AddSectionField().Format = "ALPHABETIC";
            par.AddLineBreak();

            par.AddText("SectionPages: ");
            par.AddSectionField().Format = "alphabetic";
            par.AddLineBreak();

            par.AddText("Page: ");
            par.AddPageField().Format = "ROMAN";
            par.AddLineBreak();

            par.AddText("NumPages: ");
            par.AddNumPagesField();
            par.AddLineBreak();

            par.AddText("Date: ");
            par.AddDateField();
            par.AddLineBreak();

            par.AddText("Bookmark: ");
            par.AddBookmark("Egal");
            par.AddLineBreak();

            par.AddText("PageRef: ");
            par.AddPageRefField("Egal");

            PdfPrinter printer = new PdfPrinter();

            printer.Document = document;
            printer.PrintDocument();
            printer.PdfDocument.Save(outputFile);
        }
コード例 #16
0
ファイル: TestLayout.cs プロジェクト: dankennedy/MigraDoc
        public static void TwoParagraphs(string outputFile)
        {
            Document doc = new Document();
              Section sec = doc.Sections.AddSection();

              sec.PageSetup.TopMargin = 0;
              sec.PageSetup.BottomMargin = 0;

              Paragraph par1 = sec.AddParagraph();
              TestParagraphRenderer.FillFormattedParagraph(par1);
              TestParagraphRenderer.GiveBorders(par1);
              par1.Format.SpaceAfter = "2cm";
              par1.Format.SpaceBefore = "3cm";
              Paragraph par2 = sec.AddParagraph();
              TestParagraphRenderer.FillFormattedParagraph(par2);
              TestParagraphRenderer.GiveBorders(par2);
              par2.Format.SpaceBefore = "3cm";

              PdfPrinter printer = new PdfPrinter();
              printer.Document = doc;
              printer.PrintDocument();
              printer.PdfDocument.Save(outputFile);
        }
コード例 #17
0
    public static void Fields(string outputFile)
    {
      Document document = new Document();
      Section section = document.AddSection();
      Paragraph par = section.AddParagraph();
      par.AddText("Section: ");
      par.AddSectionField().Format = "ALPHABETIC";
      par.AddLineBreak();

      par.AddText("SectionPages: ");
      par.AddSectionField().Format = "alphabetic";
      par.AddLineBreak();

      par.AddText("Page: ");
      par.AddPageField().Format = "ROMAN";
      par.AddLineBreak();
      
      par.AddText("NumPages: ");
      par.AddNumPagesField();
      par.AddLineBreak();

      par.AddText("Date: ");
      par.AddDateField();
      par.AddLineBreak();

      par.AddText("Bookmark: ");
      par.AddBookmark("Egal");
      par.AddLineBreak();

      par.AddText("PageRef: ");
      par.AddPageRefField("Egal");

      PdfPrinter printer = new PdfPrinter();
      printer.Document = document;
      printer.PrintDocument();
      printer.PdfDocument.Save(outputFile);
    }
コード例 #18
0
 public static void Tabs(string pdfOutputFile)
 {
   Document document = new Document();
   Section section = document.AddSection();
   section.PageSetup.LeftMargin = 0;
   section.PageSetup.RightMargin = 0;
   Paragraph par = section.AddParagraph();
   par.Format.TabStops.AddTabStop("20cm", TabAlignment.Right);
   par.AddText(" text before tab bla bla bla. text before tab bla bla bla. text before tab bla bla bla. text before tab bla bla bla.");
   //par.AddTab();
   par.AddText(" ............ after tab bla bla bla.");
   PdfPrinter printer = new PdfPrinter();
   printer.Document = document;
   printer.PrintDocument();
   printer.PdfDocument.Save(pdfOutputFile);
 }
コード例 #19
0
ファイル: TestTable.cs プロジェクト: dankennedy/MigraDoc
        public static void VerticalAlign(string outputFile)
        {
            Document document = new Document();
              Section sec = document.Sections.AddSection();
              sec.AddParagraph("A paragraph before.");
              Table table = sec.AddTable();
              table.Borders.Visible = true;
              table.AddColumn();
              table.AddColumn();
              Row row = table.AddRow();
              row.HeightRule = RowHeightRule.Exactly;
              row.Height = 70;
              row.VerticalAlignment = VerticalAlignment.Center;
              row[0].AddParagraph("First Cell");
              row[1].AddParagraph("Second Cell");
              sec.AddParagraph("A Paragraph afterwards.");

              PdfPrinter printer = new PdfPrinter();
              printer.Document = document;
              printer.PrintDocument();
              printer.PdfDocument.Save(outputFile);
        }