private void ConvertHtml(ExCSS.Stylesheet sheet, string html, Section section)
        {
            _sheet = sheet;
            if (string.IsNullOrEmpty(html))
            {
                throw new ArgumentNullException("html");
            }

            if (section == null)
            {
                throw new ArgumentNullException("section");
            }

            //section.PageSetup.HeaderDistance = "0.001cm";
            section.PageSetup.FooterDistance = Unit.FromCentimeter(0.01);

 // Create a paragraph with centered page number. See definition of style "Footer".
            var footer = section.Footers.Primary.AddParagraph();
            //section.Footers.Primary.
            footer.Format.Alignment = ParagraphAlignment.Right;
            footer.AddPageField();
            footer.AddText(" of ");
            footer.AddNumPagesField();
            
            var doc = new HtmlDocument();
            doc.LoadHtml(html);
            ConvertHtmlNodes(doc.DocumentNode.ChildNodes, sheet, section);
        }
示例#2
1
        /// <summary>Writes PDF for specified auto-doc commands.</summary>
        /// <param name="section">The writer to write to.</param>
        /// <param name="tags">The autodoc tags.</param>
        /// <param name="workingDirectory">The working directory.</param>
        private void TagsToMigraDoc(Section section, List<AutoDocumentation.ITag> tags, string workingDirectory)
        {
            foreach (AutoDocumentation.ITag tag in tags)
            {
                if (tag is AutoDocumentation.Heading)
                {
                    AutoDocumentation.Heading heading = tag as AutoDocumentation.Heading;
                    if (heading.headingLevel > 0 && heading.headingLevel <= 6)
                    {
                        if (heading.headingLevel == 1)
                            section.AddPageBreak();

                        Paragraph para = section.AddParagraph(heading.text, "Heading" + heading.headingLevel);
                        if (heading.headingLevel == 1)
                            para.Format.OutlineLevel = OutlineLevel.Level1;
                        else if (heading.headingLevel == 2)
                            para.Format.OutlineLevel = OutlineLevel.Level2;
                        else if (heading.headingLevel == 3)
                            para.Format.OutlineLevel = OutlineLevel.Level3;
                        else if (heading.headingLevel == 4)
                            para.Format.OutlineLevel = OutlineLevel.Level4;
                        else if (heading.headingLevel == 5)
                            para.Format.OutlineLevel = OutlineLevel.Level5;
                        else if (heading.headingLevel == 6)
                            para.Format.OutlineLevel = OutlineLevel.Level6;
                    }
                }
                else if (tag is AutoDocumentation.Paragraph)
                {
                    AddFormattedParagraphToSection(section, tag as AutoDocumentation.Paragraph);
                }
                else if (tag is AutoDocumentation.GraphAndTable)
                {
                    CreateGraphPDF(section, tag as AutoDocumentation.GraphAndTable, workingDirectory);
                }
                else if (tag is AutoDocumentation.Table)
                {
                    CreateTable(section, tag as AutoDocumentation.Table, workingDirectory);
                }
                else if (tag is Graph)
                {
                    GraphPresenter graphPresenter = new GraphPresenter();
                    GraphView graphView = new GraphView();
                    graphView.BackColor = System.Drawing.Color.White;
                    graphView.FontSize = 12;
                    graphView.Width = 500;
                    graphView.Height = 500;
                    graphPresenter.Attach(tag, graphView, ExplorerPresenter);
                    string PNGFileName = graphPresenter.ExportToPDF(workingDirectory);
                    section.AddImage(PNGFileName);
                    string caption = (tag as Graph).Caption;
                    if (caption != null)
                        section.AddParagraph(caption);
                    graphPresenter.Detach();
                }
                else if (tag is Map)
                {
                    Form f = new Form();
                    f.Width = 700; // 1100;
                    f.Height = 500; // 600;
                    MapPresenter mapPresenter = new MapPresenter();
                    MapView mapView = new MapView();
                    mapView.BackColor = System.Drawing.Color.White;
                    mapView.Parent = f;
                    (mapView as Control).Dock = DockStyle.Fill;
                    f.Show();

                    mapPresenter.Attach(tag, mapView, ExplorerPresenter);

                    Application.DoEvents();
                    Thread.Sleep(2000);
                    Application.DoEvents();
                    string PNGFileName = mapPresenter.ExportToPDF(workingDirectory);
                    section.AddImage(PNGFileName);
                    mapPresenter.Detach();

                    f.Close();
                }
                else if (tag is AutoDocumentation.Image)
                {
                    AutoDocumentation.Image imageTag = tag as AutoDocumentation.Image;
                    if (imageTag.image.Width > 700)
                        imageTag.image = ImageUtilities.ResizeImage(imageTag.image, 700, 500);
                    string PNGFileName = Path.Combine(workingDirectory, imageTag.name);
                    imageTag.image.Save(PNGFileName, System.Drawing.Imaging.ImageFormat.Png);
                    section.AddImage(PNGFileName);
                }
            }
        }
示例#3
0
 public SchoolReport()
 {
     _section           = new MigraDoc.DocumentObjectModel.Section();
     _doc               = new Document();
     _renderer          = new PdfDocumentRenderer(false, PdfFontEmbedding.Always);
     _renderer.Document = _doc;
 }
示例#4
0
        private MigraDoc.DocumentObjectModel.Document CreatePrintDocument(PrintDocument pd)
        {
            string text;

            MigraDoc.DocumentObjectModel.Document doc = new MigraDoc.DocumentObjectModel.Document();
            doc.DefaultPageSetup.PageWidth    = Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Width / 100);
            doc.DefaultPageSetup.PageHeight   = Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Height / 100);
            doc.DefaultPageSetup.TopMargin    = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Top / 100);
            doc.DefaultPageSetup.LeftMargin   = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Left / 100);
            doc.DefaultPageSetup.RightMargin  = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Right / 100);
            doc.DefaultPageSetup.BottomMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Bottom / 100);
            MigraDoc.DocumentObjectModel.Section section = doc.AddSection();
            section.PageSetup.StartingNumber = 1;
            MigraDoc.DocumentObjectModel.Font headingFont = MigraDocHelper.CreateFont(13, true);
            MigraDoc.DocumentObjectModel.Font bodyFontx   = MigraDocHelper.CreateFont(9, false);
            MigraDoc.DocumentObjectModel.Font nameFontx   = MigraDocHelper.CreateFont(9, true);
            MigraDoc.DocumentObjectModel.Font totalFontx  = MigraDocHelper.CreateFont(9, true);
            Paragraph pageNumParag = new Paragraph();

            pageNumParag.AddText(Lan.g(this, "Page") + " ");
            pageNumParag.AddPageField();
            pageNumParag.AddText(" " + Lan.g(this, "of") + " ");
            pageNumParag.AddNumPagesField();
            section.Footers.Primary.Add(pageNumParag);
            Paragraph       par       = section.AddParagraph();
            ParagraphFormat parformat = new ParagraphFormat();

            parformat.Alignment = ParagraphAlignment.Center;
            parformat.Font      = MigraDocHelper.CreateFont(14, true);
            par.Format          = parformat;
            //Render the reconcile grid.
            par = section.AddParagraph();
            par.Format.Alignment = ParagraphAlignment.Center;
            par.AddFormattedText(Lan.g(this, "RECONCILE"), totalFontx);
            par.AddLineBreak();
            text = Accounts.GetAccount(ReconcileCur.AccountNum).Description.ToUpper();
            par.AddFormattedText(text, totalFontx);
            par.AddLineBreak();
            text = PrefC.GetString(PrefName.PracticeTitle);
            par.AddText(text);
            par.AddLineBreak();
            text = PrefC.GetString(PrefName.PracticePhone);
            if (text.Length == 10 && Application.CurrentCulture.Name == "en-US")
            {
                text = "(" + text.Substring(0, 3) + ")" + text.Substring(3, 3) + "-" + text.Substring(6);
            }
            par.AddText(text);
            par.AddLineBreak();
            par.AddText(MiscData.GetNowDateTime().ToShortDateString());
            par.AddLineBreak();
            par.AddText(Lan.g(this, "Reconcile Date") + ": " + PIn.Date(textDate.Text).ToShortDateString());
            par.AddLineBreak();
            par.AddText(labelStart.Text + ": " + PIn.Double(textStart.Text).ToString("n"));
            par.AddLineBreak();
            par.AddText(labelEnd.Text + ": " + PIn.Double(textEnd.Text).ToString("n"));
            MigraDocHelper.InsertSpacer(section, 10);
            MigraDocHelper.DrawGrid(section, gridMain);
            return(doc);
        }
示例#5
0
        /// <summary>
        /// Renders content into section header
        /// </summary>
        public void RenderInto(MigraDoc.DocumentObjectModel.Section section)
        {
            HeaderFooter header = section.Headers.Primary;

            header.Format.SpaceBefore = Unit.FromMillimeter(50);

            this.childs.ForEach(child => child.RenderInto(header));
        }
        private void CreatePage()
        {
            this.section = this.document.AddSection();

            Paragraph paragraph = this.section.AddParagraph(String.Format("Order Receipt for {0}", this.data.company));
            paragraph.Style = "h1";
            paragraph.Format.SpaceAfter = 3;
        }
示例#7
0
        /// <summary>
        /// Render a title into a section
        /// </summary>
        public override void RenderInto(MigraDoc.DocumentObjectModel.Section section)
        {
            MigraDoc.DocumentObjectModel.Paragraph title = new MigraDoc.DocumentObjectModel.Paragraph();

            title.Style = "Heading1";
            this.RenderTextInto(title);

            section.Add(title);
        }
示例#8
0
 public static void AddPageBg(Section s, Document doc, byte r, byte g, byte b)
 {
     var tf = s.AddTextFrame();
     tf.FillFormat.Color = new MigraDoc.DocumentObjectModel.Color(r, g, b);
     tf.Width = doc.DefaultPageSetup.PageWidth.Point;
     tf.Height = doc.DefaultPageSetup.PageHeight.Point;
     tf.RelativeHorizontal = RelativeHorizontal.Page;
     tf.RelativeVertical = RelativeVertical.Page;
 }
示例#9
0
文件: PDF.cs 项目: reaverDK/giganten
        public static void CreatePdf(string person1, string person2, DataHandler datahandler, Dictionary <string, string[]> groups)
        {
            Document document = new Document();

            document.UseCmykColor = true;

            MigraDoc.DocumentObjectModel.Section section = document.AddSection();
            section.PageSetup.Orientation = MigraDoc.DocumentObjectModel.Orientation.Landscape;
            MigraDoc.DocumentObjectModel.Paragraph paragraph = section.AddParagraph();
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Color.FromCmyk(100, 20, 30, 50);

            if (person1 == "<Ingen sælger valgt>")
            {
                person1 = null;
            }

            if (person2 == "<Ingen sælger valgt>")
            {
                person2 = null;
            }

            if (person1 != null)
            {
                paragraph.AddFormattedText(person1, TextFormat.Bold);
                paragraph.AddLineBreak();
                paragraph.AddLineBreak();

                DefineCharts(document, person1, groups, datahandler);
            }

            if (person2 != null)
            {
                MigraDoc.DocumentObjectModel.Section newSection = document.AddSection();
                newSection.PageSetup.Orientation = MigraDoc.DocumentObjectModel.Orientation.Landscape;
                MigraDoc.DocumentObjectModel.Paragraph newParagraph = newSection.AddParagraph();

                newParagraph.AddFormattedText(person2, TextFormat.Bold);
                newParagraph.AddLineBreak();
                newParagraph.AddLineBreak();

                DefineCharts(document, person2, groups, datahandler);
            }

            const bool             unicode     = false;
            const PdfFontEmbedding embedding   = PdfFontEmbedding.Always;
            PdfDocumentRenderer    pdfRenderer = new PdfDocumentRenderer(unicode, embedding);

            pdfRenderer.Document = document;
            pdfRenderer.RenderDocument();

            string time   = DateTime.Today.ToShortDateString();
            string myfile = time + ".pdf";

            pdfRenderer.PdfDocument.Save(myfile);
            Process.Start(myfile);
        }
示例#10
0
 /// <summary>
 /// Convert the specified HTML into a MigraDoc section.
 /// </summary>
 /// <param name="html">The HTML to parse.</param>
 /// <param name="section">To section to store the elements in.</param>
 /// <param name="imagePath">Path for images.</param>
 public static void Convert(string html, Section section, string imagePath)
 {
     if (!string.IsNullOrEmpty(html) && section != null)
     {
         var doc = new HtmlDocument();
         doc.LoadHtml(html);
         ConvertNodes(doc.DocumentNode.ChildNodes, section, imagePath);
         AddStylesToDoc(section.Document);
     }
 }
示例#11
0
        public void VisitParagraph(Paragraph element)
        {
            if (_pdfSection == null)
            {
                _pdfSection = _document.AddSection();
            }

            _pdfParagraph = _pdfCell?.AddParagraph() ?? _pdfSection.AddParagraph();
            SetParagraphProperties(element.ParagraphProperties);
        }
示例#12
0
    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);
    }
示例#13
0
 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();
 }
示例#14
0
		///<summary>Creates a somewhat smaller container at an absolute position on the page</summary>
		public static TextFrame CreateContainer(Section section,float xPos,float yPos,float width,float height) {
			TextFrame framebig=section.AddTextFrame();
			framebig.RelativeVertical=RelativeVertical.Page;
			framebig.RelativeHorizontal=RelativeHorizontal.Page;
			framebig.MarginLeft=Unit.Zero;
			framebig.MarginTop=Unit.Zero;
			framebig.Top=TopPosition.Parse((yPos/100).ToString()+" in");
			framebig.Left=LeftPosition.Parse((xPos/100).ToString()+" in");
			framebig.Width=Unit.FromInch(width/100);
			framebig.Height=Unit.FromInch(height/100);
			return framebig;
		}
示例#15
0
 // contructor
 public ACRACS_Report()
 {
     school_Classes      = new List <School_Class>();
     reports_Classroooms = new List <ClassRoomReport>();
     reports_Instructors = new List <InstructorReport>();
     reports_Sections    = new List <SectionReport>();
     _section            = new MigraDoc.DocumentObjectModel.Section();
     _doc_classroom      = new Document();
     _doc_instructor     = new Document();
     _doc_section        = new Document();
     renderer            = new PdfDocumentRenderer(false, PdfFontEmbedding.Always);
 }
 /// <summary>
 /// Definiere die Seitenbreite und Seitenhoehe
 /// </summary>
 /// <param name="section">aktuelle Sektion</param>
 protected override void DefinePageSettings(Section section)
 {
     var ps = section.PageSetup;
     ps.PageHeight = new Unit(this.pageWidth, UnitType.Millimeter);
     ps.PageWidth = new Unit(this.pageHeight, UnitType.Millimeter);
     ps.LeftMargin = leftMargin - 13 + "mm";
     ps.RightMargin = rightMargin - 13 + "mm";
     //ps.TopMargin = topMargin + "mm";
     //ps.BottomMargin = bottomMargin + "mm";
     //ps.FooterDistance = FooterDistance;
     ps.Orientation = Orientation.Portrait;
 }
        void heading_tags()
        {
            new[] { 1, 2, 3, 4, 5, 6 }.Do(x =>
            {
                context["heading{0} tag".With(x)] = () =>
                {
                    pdf = new Section();
                    pdf.AddHtml("<h{0}></h{0}>".With(x));

                    it["adds a paragraph with the style 'Heading{0}'".With(x)] = ()
                        => pdf.LastParagraph.Style = "Heading{0}".With(x);
                };
            });
        }
示例#18
0
        private void ConvertHtml(string html, Section section)
        {
            if (string.IsNullOrEmpty(html))
            {
                throw new ArgumentNullException("html");
            }

            if (section == null)
            {
                throw new ArgumentNullException("section");
            }

            var doc = new HtmlDocument();
            doc.LoadHtml(html);
            ConvertHtmlNodes(doc.DocumentNode.ChildNodes, section);
        }
示例#19
0
        private void PrintReceipt(string receiptStr)
        {
            string[] receiptLines = receiptStr.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
            MigraDoc.DocumentObjectModel.Document doc = new MigraDoc.DocumentObjectModel.Document();
            doc.DefaultPageSetup.PageWidth   = Unit.FromInch(3.0);
            doc.DefaultPageSetup.PageHeight  = Unit.FromInch(0.181 * receiptLines.Length + 0.56);     //enough to print receipt text plus 9/16 inch (0.56) extra space at bottom.
            doc.DefaultPageSetup.TopMargin   = Unit.FromInch(0.25);
            doc.DefaultPageSetup.LeftMargin  = Unit.FromInch(0.25);
            doc.DefaultPageSetup.RightMargin = Unit.FromInch(0.25);
            MigraDoc.DocumentObjectModel.Font bodyFontx = MigraDocHelper.CreateFont(8, false);
            bodyFontx.Name = FontFamily.GenericMonospace.Name;
            MigraDoc.DocumentObjectModel.Section section = doc.AddSection();
            Paragraph       par       = section.AddParagraph();
            ParagraphFormat parformat = new ParagraphFormat();

            parformat.Alignment = ParagraphAlignment.Left;
            parformat.Font      = bodyFontx;
            par.Format          = parformat;
            par.AddFormattedText(receiptStr, bodyFontx);
            MigraDoc.Rendering.Printing.MigraDocPrintDocument printdoc = new MigraDoc.Rendering.Printing.MigraDocPrintDocument();
            MigraDoc.Rendering.DocumentRenderer renderer = new MigraDoc.Rendering.DocumentRenderer(doc);
            renderer.PrepareDocument();
            printdoc.Renderer = renderer;
#if DEBUG
            FormRpPrintPreview pView = new FormRpPrintPreview(printdoc);
            pView.ShowDialog();
#else
            try {
                ODprintout printout = PrinterL.CreateODprintout(
                    printSit: PrintSituation.Receipt,
                    auditPatNum: _patCur.PatNum,
                    auditDescription: Lans.g(this, "PayConnect receipt printed")
                    );
                if (PrinterL.TrySetPrinter(printout))
                {
                    printdoc.PrinterSettings = printout.PrintDoc.PrinterSettings;
                    printdoc.Print();
                }
            }
            catch (Exception ex) {
                MessageBox.Show(Lan.g(this, "Printer not available.") + "\r\n" + Lan.g(this, "Original error") + ": " + ex.Message);
            }
#endif
        }
示例#20
0
        private MigraDoc.DocumentObjectModel.Document CreatePrintDocument()
        {
            string text;

            MigraDoc.DocumentObjectModel.Document doc = new MigraDoc.DocumentObjectModel.Document();
            doc.DefaultPageSetup.PageWidth   = Unit.FromInch(8.5);
            doc.DefaultPageSetup.PageHeight  = Unit.FromInch(11);
            doc.DefaultPageSetup.TopMargin   = Unit.FromInch(.5);
            doc.DefaultPageSetup.LeftMargin  = Unit.FromInch(.5);
            doc.DefaultPageSetup.RightMargin = Unit.FromInch(.5);
            MigraDoc.DocumentObjectModel.Section section     = doc.AddSection();
            MigraDoc.DocumentObjectModel.Font    headingFont = MigraDocHelper.CreateFont(13, true);
            MigraDoc.DocumentObjectModel.Font    bodyFontx   = MigraDocHelper.CreateFont(9, false);
            MigraDoc.DocumentObjectModel.Font    nameFontx   = MigraDocHelper.CreateFont(9, true);
            MigraDoc.DocumentObjectModel.Font    totalFontx  = MigraDocHelper.CreateFont(9, true);
            Paragraph       par       = section.AddParagraph();
            ParagraphFormat parformat = new ParagraphFormat();

            parformat.Alignment = ParagraphAlignment.Center;
            parformat.Font      = MigraDocHelper.CreateFont(14, true);
            par.Format          = parformat;
            //Render the reconcile grid.
            par = section.AddParagraph();
            par.Format.Alignment = ParagraphAlignment.Center;
            par.AddFormattedText(Lan.g(this, "RECONCILE"), totalFontx);
            par.AddLineBreak();
            text = Accounts.GetAccount(ReconcileCur.AccountNum).Description.ToUpper();
            par.AddFormattedText(text, totalFontx);
            par.AddLineBreak();
            text = PrefC.GetString(PrefName.PracticeTitle);
            par.AddText(text);
            par.AddLineBreak();
            text = PrefC.GetString(PrefName.PracticePhone);
            if (text.Length == 10 && Application.CurrentCulture.Name == "en-US")
            {
                text = "(" + text.Substring(0, 3) + ")" + text.Substring(3, 3) + "-" + text.Substring(6);
            }
            par.AddText(text);
            MigraDocHelper.InsertSpacer(section, 10);
            MigraDocHelper.DrawGrid(section, gridMain);
            return(doc);
        }
示例#21
0
        public MemoryStream GetPdfStream(bool fitToPage = false)
        {
            // If we're shrinking to the page, set it here. This will likely propogate to many
            // places in the near future
            //_shouldFitToOnePage = fitTo

            // The document needs at least one section to set the orientation and margins
            _section = _document.AddSection();
            _section.PageSetup.Orientation = Orientation.Landscape;
            _section.PageSetup.LeftMargin = "0.25in";
            _section.PageSetup.RightMargin = "0.25in";
            _section.PageSetup.TopMargin = "0.25in";
            _section.PageSetup.BottomMargin = "0.25in";

            // Title (in same section)
            Paragraph paragraph = _section.AddParagraph();
            paragraph.AddText(_title);
            paragraph.AddLineBreak();
            paragraph.Style = StyleNames.Heading1;

            // Footer (in same section)
            paragraph = _section.Footers.Primary.AddParagraph();
            paragraph.AddText(_footer);
            paragraph.Format.Alignment = ParagraphAlignment.Center;

            // Table (in same section)
            AddTable();

            // Document is now built, so start rendering it
            _pdfRenderer = new PdfDocumentRenderer();
            // attach document
            _pdfRenderer.Document = _document;

            // This will output it as a stream which is passed to the browser
            MemoryStream memoryStream = new MemoryStream();
            _pdfRenderer.RenderDocument();
            // "false" doesn't close the stream. If the stream is closed, you get fun HTTP 500 errors
            _pdfRenderer.PdfDocument.Save(memoryStream, false);

            // Pass it back as a file so it can be passed to the browser
            return memoryStream;
        }
示例#22
0
		///<Summary>Creates a container frame in a section.  This allows other objects to be placed absolutely within a given area by adding more textframes within this one.  This frame is full width and is automatically placed after previous elements.</Summary>
		public static TextFrame CreateContainer(Section section){
			TextFrame framebig=section.AddTextFrame();
			framebig.RelativeVertical=RelativeVertical.Line;
			framebig.RelativeHorizontal=RelativeHorizontal.Page;
			framebig.MarginLeft=Unit.Zero;
			framebig.MarginTop=Unit.Zero;
			framebig.Top=TopPosition.Parse("0 in");
			framebig.Left=LeftPosition.Parse("0 in");
			if(CultureInfo.CurrentCulture.Name=="en-US"){
				framebig.Width=Unit.FromInch(8.5);
			}
			//don't know about Canada
			else{
				framebig.Width=Unit.FromInch(8.3);
			}
			//LineFormat lineformat=new LineFormat();
			//lineformat.Width=1;
			//framebig.LineFormat=lineformat;
			return framebig;
		}
示例#23
0
        /// <summary>
        /// Returns a section rendered
        /// </summary>
        public DocumentObject Render()
        {
            MigraDoc.DocumentObjectModel.Section section = new MigraDoc.DocumentObjectModel.Section();

            this.childs.ForEach(child => child.RenderInto(section));

            if (this.header != null)
            {
                this.header.RenderInto(section);
            }

            if (this.headerHeight.HasValue)
            {
                section.PageSetup.TopMargin = Unit.FromMillimeter(this.headerHeight.Value);
            }

            section.PageSetup.HeaderDistance = Unit.FromMillimeter(0.8);

            return(section);
        }
示例#24
0
 private static void DrawRecipe(RecipeEntry recipe, ref Section section)
 {
     ///<example>
     ///     [Recipe Name]
     ///     [Recipe Source]
     ///  [Recipe Description]
     ///  [# Recipe Ingredients]
     ///  [Recipe Preparation Instructions]
     ///  [Recipe Cooking Instructions]
     /// </example>
     Paragraph headerText = section.AddParagraph();
     Paragraph DescParagraph = section.AddParagraph();
     Paragraph ingredientList = section.AddParagraph();
     Paragraph PrepInstr = section.AddParagraph();
     Paragraph CookInstr = section.AddParagraph();
     Font header = new Font("Times New Roman Bold", 20);
     Font body = new Font("Times New Roman", 14);
     headerText.Format = HeaderFormatter();
     headerText.AddFormattedText(recipe.Name, header);
     headerText.AddLineBreak();
     headerText.AddFormattedText("(" + recipe.Source + ")", new Font("Times New Roman", 16));
     DescParagraph.Format = BodyFormatter();
     DescParagraph.AddFormattedText(recipe.Description, body);
     ingredientList.Format = IngredientFormatter();
     int count = 1;
     foreach (IngredientEntry i in recipe.Ingredients)
     {
         string entry = count.ToString() + ") " + i.ToString();
         ingredientList.AddFormattedText(entry, body);
         ingredientList.AddLineBreak();
         count++;
     }
     PrepInstr.Format = BodyFormatter();
     PrepInstr.AddFormattedText(recipe.PrepInstructions, body);
     CookInstr.Format = BodyFormatter();
     CookInstr.AddFormattedText(recipe.CookInstructions, body);
 }
示例#25
0
        private void PrintReceipt(string receiptStr)
        {
            string[] receiptLines = receiptStr.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);
            MigraDoc.DocumentObjectModel.Document doc = new MigraDoc.DocumentObjectModel.Document();
            doc.DefaultPageSetup.PageWidth   = Unit.FromInch(3.0);
            doc.DefaultPageSetup.PageHeight  = Unit.FromInch(0.181 * receiptLines.Length + 0.56);     //enough to print receipt text plus 9/16 inch (0.56) extra space at bottom.
            doc.DefaultPageSetup.TopMargin   = Unit.FromInch(0.25);
            doc.DefaultPageSetup.LeftMargin  = Unit.FromInch(0.25);
            doc.DefaultPageSetup.RightMargin = Unit.FromInch(0.25);
            MigraDoc.DocumentObjectModel.Font bodyFontx = MigraDocHelper.CreateFont(8, false);
            bodyFontx.Name = FontFamily.GenericMonospace.Name;
            MigraDoc.DocumentObjectModel.Section section = doc.AddSection();
            Paragraph       par       = section.AddParagraph();
            ParagraphFormat parformat = new ParagraphFormat();

            parformat.Alignment = ParagraphAlignment.Left;
            parformat.Font      = bodyFontx;
            par.Format          = parformat;
            par.AddFormattedText(receiptStr, bodyFontx);
            MigraDoc.Rendering.Printing.MigraDocPrintDocument printdoc = new MigraDoc.Rendering.Printing.MigraDocPrintDocument();
            MigraDoc.Rendering.DocumentRenderer renderer = new MigraDoc.Rendering.DocumentRenderer(doc);
            renderer.PrepareDocument();
            printdoc.Renderer = renderer;
            //we might want to surround some of this with a try-catch
#if DEBUG
            FormRpPrintPreview pView = new FormRpPrintPreview();
            pView.printPreviewControl2.Document = printdoc;
            pView.ShowDialog();
#else
            if (PrinterL.SetPrinter(pd2, PrintSituation.Receipt, PatCur.PatNum, "PayConnect receipt printed"))
            {
                printdoc.PrinterSettings = pd2.PrinterSettings;
                printdoc.Print();
            }
#endif
        }
示例#26
0
        /// <summary>
        /// Add a text frame.
        /// </summary>
        /// <param name="section"></param>
        private static void AddCodeBlock(Section section, string text)
        {
            Table table = section.AddTable();
            table.Borders.Width = "0.5pt";
            table.Borders.Color = MigraDoc.DocumentObjectModel.Colors.DarkGray;
            table.LeftPadding = "5mm";
            table.Rows.LeftIndent = "0cm";

            var column = table.AddColumn();
            column.Width = Unit.FromMillimeter(180);

            Row row = table.AddRow();

            string[] lines = text.Split(new string[] { "\r\n" }, StringSplitOptions.None);

            foreach (string line in lines)
            {
                int numSpaces = StringUtilities.IndexNotOfAny(line, " ".ToCharArray(), 0);
                Paragraph p = row[0].AddParagraph();
                p.AddSpace(numSpaces);
                p.AddText(line);
                p.Style = "TableParagraph";
            }
        }
示例#27
0
 /// <summary>
 /// Adds a new section.
 /// </summary>
 public Section AddSection()
 {
   Section section = new Section();
   this.Add(section);
   return section;
 }
示例#28
0
        /// <summary>
        /// Render a image into a section
        /// </summary>
        public void RenderInto(MigraDoc.DocumentObjectModel.Section section)
        {
            MigraDoc.DocumentObjectModel.Shapes.Image image = this.CreateImage();

            section.Add(image);
        }
        private void RenderCellToPdf(Section section, Whiteboard.Cell cell)
        {
            // Header
            Paragraph paragraph = section.AddParagraph();
            paragraph.Format.SpaceBefore = new Unit(10, UnitType.Point);
            paragraph.Format.LeftIndent = new Unit(10, UnitType.Point);
            paragraph.Format.Font.Color = Color.FromCmyk(100, 30, 20, 50);
            paragraph.AddFormattedText(
                cell.Column.Caption,
                TextFormat.Bold);

            // Value
            string value = cell.Value ?? "";
            paragraph = section.AddParagraph();
            paragraph.Format.LeftIndent = new Unit(20, UnitType.Point);
            paragraph.Format.Font.Color = Color.FromCmyk(100, 120, 120, 120);
            paragraph.AddFormattedText(value);
        }
示例#30
0
 /// <summary>
 /// Interface for rendering into a section
 /// </summary>
 public abstract void RenderInto(MigraDoc.DocumentObjectModel.Section section);
示例#31
0
        private void CreatePage()
        {
            // Each MigraDoc document needs at least one section.
            MigraDoc.DocumentObjectModel.Section section = this.document.AddSection();

            // Put a logo in the header
            Image image = section.Headers.Primary.AddImage("Image_Icons/logo1.png");

            image.Height             = "2.5cm";
            image.Width              = "5cm";
            image.LockAspectRatio    = true;
            image.RelativeVertical   = RelativeVertical.Line;
            image.RelativeHorizontal = RelativeHorizontal.Margin;
            image.Top              = ShapePosition.Top;
            image.Left             = ShapePosition.Right;
            image.WrapFormat.Style = WrapStyle.Through;

            // Create the text frame for the address
            this.addressFrame                    = section.AddTextFrame();
            this.addressFrame.Height             = "8.0cm";
            this.addressFrame.Width              = "10.0cm";
            this.addressFrame.Left               = ShapePosition.Left;
            this.addressFrame.RelativeHorizontal = RelativeHorizontal.Margin;
            this.addressFrame.Top                = "4cm";
            this.addressFrame.RelativeVertical   = RelativeVertical.Page;

            this.PriceFrame                    = section.AddTextFrame();
            this.PriceFrame.Height             = "5.0cm";
            this.PriceFrame.Width              = "5.0cm";
            this.PriceFrame.Left               = ShapePosition.Right;
            this.PriceFrame.RelativeHorizontal = RelativeHorizontal.Margin;
            this.PriceFrame.Top                = "4.0cm";
            this.PriceFrame.RelativeVertical   = RelativeVertical.Page;

            // Put sender in address frame
            //= addressFrame.AddParagraph("ul.Pralki 5, 13-342 Lodówka");
            //paragraph.Format.Font.Name = "Times New Roman";
            //paragraph.Format.Font.Size = 7;
            //paragraph.Format.SpaceAfter = 3;

            // Add the print date field
            MigraDoc.DocumentObjectModel.Paragraph paragraph = section.AddParagraph();
            paragraph.Format.SpaceBefore = "8cm";
            paragraph.Style = "Reference";
            paragraph.AddFormattedText($"Faktura nr {order.Date.Year}/{order.Id}", TextFormat.Bold);
            paragraph.AddTab();
            paragraph.AddText("Białystok, ");
            paragraph.AddDateField("dd.MM.yyyy");

            paragraph = section.Footers.Primary.AddParagraph();
            paragraph.AddText($"\u00a9 2021 RTV&AGD \n ul.Pralki 5, 13-342 Lodówka \n Data wydruku: {DateTime.Now.ToString("dd-MM-yyyy HH:mm:ss")} ");
            paragraph.Format.Font.Size = 9;
            paragraph.Format.Alignment = ParagraphAlignment.Center;

            // Create the item table
            this.table                = section.AddTable();
            table.Format.Alignment    = ParagraphAlignment.Justify;
            table.Borders.Color       = MigraDoc.DocumentObjectModel.Colors.Black;
            table.Borders.Width       = 0.25;
            table.Borders.Left.Width  = 0.5;
            table.Borders.Right.Width = 0.5;
            table.Rows.LeftIndent     = 5;
            table.TopPadding          = 10;
            table.BottomPadding       = 10;

            // Before you can add a row, you must define the columns
            Column column = this.table.AddColumn("7.5cm");

            column.Format.Alignment = ParagraphAlignment.Center;

            column = this.table.AddColumn("1.5cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = this.table.AddColumn("3.5cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = this.table.AddColumn("3.5cm");
            column.Format.Alignment = ParagraphAlignment.Right;


            // Create the header of the table
            Row row = table.AddRow();

            row.HeadingFormat    = true;
            row.Format.Alignment = ParagraphAlignment.Left;
            row.Format.Font.Bold = true;
            row.Shading.Color    = TableBlue;
            row.Cells[0].AddParagraph("Nazwa");
            row.Cells[0].Format.Font.Bold  = true;
            row.Cells[0].Format.Alignment  = ParagraphAlignment.Left;
            row.Cells[0].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Center;

            row.Cells[1].AddParagraph("Ilość");
            row.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            row.Cells[2].AddParagraph("Cena/szt");
            row.Cells[2].Format.Alignment  = ParagraphAlignment.Left;
            row.Cells[2].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Center;

            row.Cells[3].AddParagraph("Wartosc");
            row.Cells[3].Format.Alignment  = ParagraphAlignment.Left;
            row.Cells[3].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Center;



            this.table.SetEdge(0, 0, 4, 1, Edge.Box, BorderStyle.Single, 0.75, MigraDoc.DocumentObjectModel.Color.Empty);
        }
示例#32
0
        ///<summary>Supply pd so that we know the paper size and margins.</summary>
        public static void CreateDocument(FormRpStatement sender, MigraDoc.DocumentObjectModel.Document doc, PrintDocument pd, Family fam, Patient pat, DataSet dataSet, Statement Stmt)
        {
            //doc= new MigraDoc.DocumentObjectModel.Document();//don't do this or the reference to the original doc will be lost.
            doc.DefaultPageSetup.PageWidth    = Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Width / 100);
            doc.DefaultPageSetup.PageHeight   = Unit.FromInch((double)pd.DefaultPageSettings.PaperSize.Height / 100);
            doc.DefaultPageSetup.TopMargin    = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Top / 100);
            doc.DefaultPageSetup.LeftMargin   = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Left / 100);
            doc.DefaultPageSetup.RightMargin  = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Right / 100);
            doc.DefaultPageSetup.BottomMargin = Unit.FromInch((double)pd.DefaultPageSettings.Margins.Bottom / 100);
            MigraDoc.DocumentObjectModel.Section section = doc.AddSection();          //so that Swiss will have different footer for each patient.
            string text;

            MigraDoc.DocumentObjectModel.Font font;
            //GetPatGuar(PatNums[famIndex][0]);
            //Family fam=Patients.GetFamily(Stmt.PatNum);
            Patient PatGuar = fam.ListPats[0];          //.Copy();
            //Patient pat=fam.GetPatient(Stmt.PatNum);
            DataTable tableMisc = dataSet.Tables["misc"];

            //HEADING------------------------------------------------------------------------------
            #region Heading
            Paragraph       par       = section.AddParagraph();
            ParagraphFormat parformat = new ParagraphFormat();
            parformat.Alignment = ParagraphAlignment.Center;
            par.Format          = parformat;
            font = MigraDocHelper.CreateFont(14, true);
            text = "This statement was generated from the plug-in";
            par.AddFormattedText(text, font);
            text = DateTime.Today.ToShortDateString();
            font = MigraDocHelper.CreateFont(10);
            par.AddLineBreak();
            par.AddFormattedText(text, font);
            text = Lan.g("FormRpStatement", "Account Number") + " ";
            if (PrefC.GetBool(PrefName.StatementAccountsUseChartNumber))
            {
                text += PatGuar.ChartNumber;
            }
            else
            {
                text += PatGuar.PatNum;
            }
            par.AddLineBreak();
            par.AddFormattedText(text, font);
            TextFrame frame;
            #endregion
            //Practice Address----------------------------------------------------------------------
            #region Practice Address
            if (PrefC.GetBool(PrefName.StatementShowReturnAddress))
            {
                font  = MigraDocHelper.CreateFont(10);
                frame = section.AddTextFrame();
                frame.RelativeVertical   = RelativeVertical.Page;
                frame.RelativeHorizontal = RelativeHorizontal.Page;
                frame.MarginLeft         = Unit.Zero;
                frame.MarginTop          = Unit.Zero;
                frame.Top   = TopPosition.Parse("0.5 in");
                frame.Left  = LeftPosition.Parse("0.3 in");
                frame.Width = Unit.FromInch(3);
                if (!PrefC.GetBool(PrefName.EasyNoClinics) && Clinics.List.Length > 0 &&           //if using clinics
                    Clinics.GetClinic(PatGuar.ClinicNum) != null)                             //and this patient assigned to a clinic
                {
                    Clinic clinic = Clinics.GetClinic(PatGuar.ClinicNum);
                    par             = frame.AddParagraph();
                    par.Format.Font = font;
                    par.AddText(clinic.Description);
                    par.AddLineBreak();
                    par.AddText(clinic.Address);
                    par.AddLineBreak();
                    if (clinic.Address2 != "")
                    {
                        par.AddText(clinic.Address2);
                        par.AddLineBreak();
                    }
                    if (CultureInfo.CurrentCulture.Name.EndsWith("CH"))                     //CH is for switzerland. eg de-CH
                    {
                        par.AddText(clinic.Zip + " " + clinic.City);
                    }
                    else
                    {
                        par.AddText(clinic.City + ", " + clinic.State + " " + clinic.Zip);
                    }
                    par.AddLineBreak();
                    text = clinic.Phone;
                    if (text.Length == 10)
                    {
                        text = "(" + text.Substring(0, 3) + ")" + text.Substring(3, 3) + "-" + text.Substring(6);
                    }
                    par.AddText(text);
                    par.AddLineBreak();
                }
                else
                {
                    par             = frame.AddParagraph();
                    par.Format.Font = font;
                    par.AddText(PrefC.GetString(PrefName.PracticeTitle));
                    par.AddLineBreak();
                    if (CultureInfo.CurrentCulture.Name == "en-AU")                   //English (Australia)
                    {
                        Provider defaultProv = Providers.GetProv(PrefC.GetLong(PrefName.PracticeDefaultProv));
                        par.AddText("ABN: " + defaultProv.NationalProvID);
                        par.AddLineBreak();
                    }
                    par.AddText(PrefC.GetString(PrefName.PracticeAddress));
                    par.AddLineBreak();
                    if (PrefC.GetString(PrefName.PracticeAddress2) != "")
                    {
                        par.AddText(PrefC.GetString(PrefName.PracticeAddress2));
                        par.AddLineBreak();
                    }
                    if (CultureInfo.CurrentCulture.Name.EndsWith("CH"))                     //CH is for switzerland. eg de-CH
                    {
                        par.AddText(PrefC.GetString(PrefName.PracticeZip) + " " + PrefC.GetString(PrefName.PracticeCity));
                    }
                    else
                    {
                        par.AddText(PrefC.GetString(PrefName.PracticeCity) + ", " + PrefC.GetString(PrefName.PracticeST) + " " + PrefC.GetString(PrefName.PracticeZip));
                    }
                    par.AddLineBreak();
                    text = PrefC.GetString(PrefName.PracticePhone);
                    if (text.Length == 10)
                    {
                        text = "(" + text.Substring(0, 3) + ")" + text.Substring(3, 3) + "-" + text.Substring(6);
                    }
                    par.AddText(text);
                    par.AddLineBreak();
                }
            }
            #endregion
            //AMOUNT ENCLOSED------------------------------------------------------------------------------------------------------
            #region Amount Enclosed
            Table  table;
            Column col;
            Row    row;
            Cell   cell;
            frame = MigraDocHelper.CreateContainer(section, 450, 110, 330, 29);
            if (!Stmt.HidePayment)
            {
                table = MigraDocHelper.DrawTable(frame, 0, 0, 29);
                col   = table.AddColumn(Unit.FromInch(1.1));
                col   = table.AddColumn(Unit.FromInch(1.1));
                col   = table.AddColumn(Unit.FromInch(1.1));
                row   = table.AddRow();
                row.Format.Alignment = ParagraphAlignment.Center;
                row.Borders.Color    = Colors.Black;
                row.Shading.Color    = Colors.LightGray;
                row.TopPadding       = Unit.FromInch(0);
                row.BottomPadding    = Unit.FromInch(0);
                font = MigraDocHelper.CreateFont(8, true);
                cell = row.Cells[0];
                par  = cell.AddParagraph();
                par.AddFormattedText(Lan.g("FormRpStatement", "Amount Due"), font);
                cell = row.Cells[1];
                par  = cell.AddParagraph();
                par.AddFormattedText(Lan.g("FormRpStatement", "Date Due"), font);
                cell = row.Cells[2];
                par  = cell.AddParagraph();
                par.AddFormattedText(Lan.g("FormRpStatement", "Amount Enclosed"), font);
                row = table.AddRow();
                row.Format.Alignment     = ParagraphAlignment.Center;
                row.Borders.Left.Color   = Colors.Gray;
                row.Borders.Bottom.Color = Colors.Gray;
                row.Borders.Right.Color  = Colors.Gray;
                font = MigraDocHelper.CreateFont(9);
                double balTotal = PatGuar.BalTotal;
                if (!PrefC.GetBool(PrefName.BalancesDontSubtractIns))                 //this is typical
                {
                    balTotal -= PatGuar.InsEst;
                }
                for (int m = 0; m < tableMisc.Rows.Count; m++)
                {
                    if (tableMisc.Rows[m]["descript"].ToString() == "payPlanDue")
                    {
                        balTotal += PIn.Double(tableMisc.Rows[m]["value"].ToString());
                        //payPlanDue;//PatGuar.PayPlanDue;
                    }
                }
                text = balTotal.ToString("F");
                cell = row.Cells[0];
                par  = cell.AddParagraph();
                par.AddFormattedText(text, font);
                if (PrefC.GetLong(PrefName.StatementsCalcDueDate) == -1)
                {
                    text = Lan.g("FormRpStatement", "Upon Receipt");
                }
                else
                {
                    text = DateTime.Today.AddDays(PrefC.GetLong(PrefName.StatementsCalcDueDate)).ToShortDateString();
                }
                cell = row.Cells[1];
                par  = cell.AddParagraph();
                par.AddFormattedText(text, font);
            }
            #endregion
            //Credit Card Info--------------------------------------------------------------------------------------------------------
            #region Credit Card Info
            if (!Stmt.HidePayment)
            {
                if (PrefC.GetBool(PrefName.StatementShowCreditCard))
                {
                    float yPos = 60;
                    font = MigraDocHelper.CreateFont(7, true);
                    text = Lan.g("FormRpStatement", "CREDIT CARD TYPE");
                    MigraDocHelper.DrawString(frame, text, font, 0, yPos);
                    float rowHeight            = 26;
                    System.Drawing.Font  wfont = new System.Drawing.Font("Arial", 7, FontStyle.Bold);
                    System.Drawing.Image img   = new Bitmap(500, 30);
                    Graphics             g     = Graphics.FromImage(img);  //just to measure strings
                    MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width,
                                            yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g));
                    yPos += rowHeight;
                    text  = Lan.g("FormRpStatement", "#");
                    MigraDocHelper.DrawString(frame, text, font, 0, yPos);
                    MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width,
                                            yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g));
                    yPos += rowHeight;
                    text  = Lan.g("FormRpStatement", "3 DIGIT CSV");
                    MigraDocHelper.DrawString(frame, text, font, 0, yPos);
                    MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width,
                                            yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g));
                    yPos += rowHeight;
                    text  = Lan.g("FormRpStatement", "EXPIRES");
                    MigraDocHelper.DrawString(frame, text, font, 0, yPos);
                    MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width,
                                            yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g));
                    yPos += rowHeight;
                    text  = Lan.g("FormRpStatement", "AMOUNT APPROVED");
                    MigraDocHelper.DrawString(frame, text, font, 0, yPos);
                    MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width,
                                            yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g));
                    yPos += rowHeight;
                    text  = Lan.g("FormRpStatement", "NAME");
                    MigraDocHelper.DrawString(frame, text, font, 0, yPos);
                    MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width,
                                            yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g));
                    yPos += rowHeight;
                    text  = Lan.g("FormRpStatement", "SIGNATURE");
                    MigraDocHelper.DrawString(frame, text, font, 0, yPos);
                    MigraDocHelper.DrawLine(frame, System.Drawing.Color.Black, g.MeasureString(text, wfont).Width,
                                            yPos + wfont.GetHeight(g), 326, yPos + wfont.GetHeight(g));
                    yPos -= rowHeight;
                    text  = Lan.g("FormRpStatement", "(As it appears on card)");
                    wfont = new System.Drawing.Font("Arial", 5);
                    font  = MigraDocHelper.CreateFont(5);
                    MigraDocHelper.DrawString(frame, text, font, 625 - g.MeasureString(text, wfont).Width / 2 + 5, yPos + 13);
                    g.Dispose();
                    img = null;
                }
            }
            #endregion
            //Patient's Billing Address---------------------------------------------------------------------------------------------
            #region Patient Billing Address
            font            = MigraDocHelper.CreateFont(11);
            frame           = MigraDocHelper.CreateContainer(section, 62.5f + 12.5f, 225 + 1, 300, 200);
            par             = frame.AddParagraph();
            par.Format.Font = font;
            if (Stmt.SinglePatient)
            {
                par.AddText(fam.GetNameInFamFL(Stmt.PatNum));
            }
            else
            {
                par.AddText(PatGuar.GetNameFLFormal());
            }
            par.AddLineBreak();
            par.AddText(PatGuar.Address);
            par.AddLineBreak();
            if (PatGuar.Address2 != "")
            {
                par.AddText(PatGuar.Address2);
                par.AddLineBreak();
            }
            if (CultureInfo.CurrentCulture.Name.EndsWith("CH"))             //CH is for switzerland. eg de-CH
            {
                par.AddText(PatGuar.Zip + " " + PatGuar.City);
            }
            else
            {
                par.AddText(PatGuar.City + ", " + PatGuar.State + " " + PatGuar.Zip);
            }
            //perforated line------------------------------------------------------------------------------------------------------
            //yPos=350;//3.62 inches from top, 1/3 page down
            frame = MigraDocHelper.CreateContainer(section, 0, 350, 850, 30);
            if (!Stmt.HidePayment)
            {
                MigraDocHelper.DrawLine(frame, System.Drawing.Color.LightGray, 0, 0, 850, 0);
                text = Lan.g("FormRpStatement", "PLEASE DETACH AND RETURN THE UPPER PORTION WITH YOUR PAYMENT");
                font = MigraDocHelper.CreateFont(6, true, System.Drawing.Color.Gray);
                par  = frame.AddParagraph();
                par.Format.Alignment = ParagraphAlignment.Center;
                par.Format.Font      = font;
                par.AddText(text);
            }
            #endregion
            //Australian Provider Legend
            #region Australian Provider Legend
            int legendOffset = 0;
            if (CultureInfo.CurrentCulture.Name == "en-AU")           //English (Australia)
            {
                Providers.RefreshCache();
                legendOffset = 25 + 15 * (1 + ProviderC.List.Length);
                MigraDocHelper.InsertSpacer(section, legendOffset);
                frame           = MigraDocHelper.CreateContainer(section, 45, 390, 250, legendOffset);
                par             = frame.AddParagraph();
                par.Format.Font = MigraDocHelper.CreateFont(8, true);
                par.AddLineBreak();
                par.AddText("PROVIDERS:");
                par             = frame.AddParagraph();
                par.Format.Font = MigraDocHelper.CreateFont(8, false);
                for (int i = 0; i < ProviderC.List.Length; i++)           //All non-hidden providers are added to the legend.
                {
                    Provider prov   = ProviderC.List[i];
                    string   suffix = "";
                    if (prov.Suffix.Trim() != "")
                    {
                        suffix = ", " + prov.Suffix.Trim();
                    }
                    par.AddText(prov.Abbr + " - " + prov.FName + " " + prov.LName + suffix + " - " + prov.MedicaidID);
                    par.AddLineBreak();
                }
                par.AddLineBreak();
            }
            #endregion
            //Aging-----------------------------------------------------------------------------------
            #region Aging
            MigraDocHelper.InsertSpacer(section, 275);
            frame = MigraDocHelper.CreateContainer(section, 55, 390 + legendOffset, 250, 29);
            if (!Stmt.HidePayment)
            {
                table = MigraDocHelper.DrawTable(frame, 0, 0, 29);
                col   = table.AddColumn(Unit.FromInch(1.1));
                col   = table.AddColumn(Unit.FromInch(1.1));
                col   = table.AddColumn(Unit.FromInch(1.1));
                col   = table.AddColumn(Unit.FromInch(1.1));
                row   = table.AddRow();
                row.Format.Alignment = ParagraphAlignment.Center;
                row.Borders.Color    = Colors.Black;
                row.Shading.Color    = Colors.LightGray;
                row.TopPadding       = Unit.FromInch(0);
                row.BottomPadding    = Unit.FromInch(0);
                font = MigraDocHelper.CreateFont(8, true);
                cell = row.Cells[0];
                par  = cell.AddParagraph();
                par.AddFormattedText(Lan.g("FormRpStatement", "0-30"), font);
                cell = row.Cells[1];
                par  = cell.AddParagraph();
                par.AddFormattedText(Lan.g("FormRpStatement", "31-60"), font);
                cell = row.Cells[2];
                par  = cell.AddParagraph();
                par.AddFormattedText(Lan.g("FormRpStatement", "61-90"), font);
                cell = row.Cells[3];
                par  = cell.AddParagraph();
                par.AddFormattedText(Lan.g("FormRpStatement", "over 90"), font);
                row = table.AddRow();
                row.Format.Alignment     = ParagraphAlignment.Center;
                row.Borders.Left.Color   = Colors.Gray;
                row.Borders.Bottom.Color = Colors.Gray;
                row.Borders.Right.Color  = Colors.Gray;
                font = MigraDocHelper.CreateFont(9);
                text = PatGuar.Bal_0_30.ToString("F");
                cell = row.Cells[0];
                par  = cell.AddParagraph();
                par.AddFormattedText(text, font);
                text = PatGuar.Bal_31_60.ToString("F");
                cell = row.Cells[1];
                par  = cell.AddParagraph();
                par.AddFormattedText(text, font);
                text = PatGuar.Bal_61_90.ToString("F");
                cell = row.Cells[2];
                par  = cell.AddParagraph();
                par.AddFormattedText(text, font);
                text = PatGuar.BalOver90.ToString("F");
                cell = row.Cells[3];
                par  = cell.AddParagraph();
                par.AddFormattedText(text, font);
            }
            #endregion
            //Floating Balance, Ins info-------------------------------------------------------------------
            #region FloatingBalance
            frame = MigraDocHelper.CreateContainer(section, 460, 380 + legendOffset, 250, 200);
            //table=MigraDocHelper.DrawTable(frame,0,0,90);
            par                 = frame.AddParagraph();
            parformat           = new ParagraphFormat();
            parformat.Alignment = ParagraphAlignment.Right;
            par.Format          = parformat;
            font                = MigraDocHelper.CreateFont(10, false);
            MigraDoc.DocumentObjectModel.Font fontBold = MigraDocHelper.CreateFont(10, true);
            if (PrefC.GetBool(PrefName.BalancesDontSubtractIns))
            {
                text = Lan.g("FormRpStatement", "Balance:");
                par.AddFormattedText(text, fontBold);
                //par.AddLineBreak();
                //text = Lan.g(this, "Ins Pending:");
                //par.AddFormattedText(text, font);
                //par.AddLineBreak();
                //text = Lan.g(this, "After Ins:");
                //par.AddFormattedText(text, font);
                //par.AddLineBreak();
            }
            else              //this is more common
            {
                if (PrefC.GetBool(PrefName.FuchsOptionsOn))
                {
                    text = Lan.g("FormRpStatement", "Balance:");
                    par.AddFormattedText(text, font);
                    par.AddLineBreak();
                    text = Lan.g("FormRpStatement", "-Ins Estimate:");
                    par.AddFormattedText(text, font);
                    par.AddLineBreak();
                    text = Lan.g("FormRpStatement", "=Owed Now:");
                    par.AddFormattedText(text, fontBold);
                    par.AddLineBreak();
                }
                else
                {
                    text = Lan.g("FormRpStatement", "Total:");
                    par.AddFormattedText(text, font);
                    par.AddLineBreak();
                    text = Lan.g("FormRpStatement", "-Ins Estimate:");
                    par.AddFormattedText(text, font);
                    par.AddLineBreak();
                    text = Lan.g("FormRpStatement", "=Balance:");
                    par.AddFormattedText(text, fontBold);
                    par.AddLineBreak();
                }
            }
            frame = MigraDocHelper.CreateContainer(section, 730, 380 + legendOffset, 100, 200);
            //table=MigraDocHelper.DrawTable(frame,0,0,90);
            par                 = frame.AddParagraph();
            parformat           = new ParagraphFormat();
            parformat.Alignment = ParagraphAlignment.Left;
            par.Format          = parformat;
            font                = MigraDocHelper.CreateFont(10, false);
            //numbers:
            if (PrefC.GetBool(PrefName.BalancesDontSubtractIns))
            {
                text = PatGuar.BalTotal.ToString("c");
                par.AddFormattedText(text, fontBold);
                //par.AddLineBreak();
                //text = PatGuar.InsEst.ToString("c");
                //par.AddFormattedText(text, font);
                //par.AddLineBreak();
                //text = (PatGuar.BalTotal - PatGuar.InsEst).ToString("c");
                //par.AddFormattedText(text, font);
                //par.AddLineBreak();
            }
            else              //more common
            {
                if (Stmt.SinglePatient)
                {
                    double patInsEst = 0;
                    for (int m = 0; m < tableMisc.Rows.Count; m++)
                    {
                        if (tableMisc.Rows[m]["descript"].ToString() == "patInsEst")
                        {
                            patInsEst = PIn.Double(tableMisc.Rows[m]["value"].ToString());
                        }
                    }
                    double patBal = pat.EstBalance - patInsEst;
                    text = pat.EstBalance.ToString("c");
                    par.AddFormattedText(text, font);
                    par.AddLineBreak();
                    text = patInsEst.ToString("c");
                    par.AddFormattedText(text, font);
                    par.AddLineBreak();
                    text = patBal.ToString("c");
                    par.AddFormattedText(text, fontBold);
                }
                else
                {
                    text = PatGuar.BalTotal.ToString("c");
                    par.AddFormattedText(text, font);
                    par.AddLineBreak();
                    text = PatGuar.InsEst.ToString("c");
                    par.AddFormattedText(text, font);
                    par.AddLineBreak();
                    text = (PatGuar.BalTotal - PatGuar.InsEst).ToString("c");
                    par.AddFormattedText(text, fontBold);
                    par.AddLineBreak();
                }
            }
            MigraDocHelper.InsertSpacer(section, 80);
            #endregion FloatingBalance
            //Bold note-------------------------------------------------------------------------------
            #region Bold note
            if (Stmt.NoteBold != "")
            {
                MigraDocHelper.InsertSpacer(section, 7);
                font            = MigraDocHelper.CreateFont(10, true, System.Drawing.Color.DarkRed);
                par             = section.AddParagraph();
                par.Format.Font = font;
                par.AddText(Stmt.NoteBold);
                MigraDocHelper.InsertSpacer(section, 8);
            }
            #endregion Bold note
            //Payment plan grid definition---------------------------------------------------------------------------------
            #region PayPlan grid definition
            ODGridColumn gcol;
            ODGridRow    grow;
            ODGrid       gridPP = new ODGrid();
            //this.Controls.Add(gridPP);
            gridPP.BeginUpdate();
            gridPP.Columns.Clear();
            gcol = new ODGridColumn(Lan.g("FormRpStatement", "Date"), 73);
            gridPP.Columns.Add(gcol);
            gcol = new ODGridColumn(Lan.g("FormRpStatement", "Description"), 270);
            gridPP.Columns.Add(gcol);
            gcol = new ODGridColumn(Lan.g("FormRpStatement", "Charges"), 60, HorizontalAlignment.Right);
            gridPP.Columns.Add(gcol);
            gcol = new ODGridColumn(Lan.g("FormRpStatement", "Credits"), 60, HorizontalAlignment.Right);
            gridPP.Columns.Add(gcol);
            gcol = new ODGridColumn(Lan.g("FormRpStatement", "Balance"), 60, HorizontalAlignment.Right);
            gridPP.Columns.Add(gcol);
            gridPP.Width = gridPP.WidthAllColumns + 20;
            gridPP.EndUpdate();
            #endregion PayPlan grid definition
            //Payment plan grid.  There will be only one, if any-----------------------------------------------------------------
            #region PayPlan grid
            DataTable  tablePP = dataSet.Tables["payplan"];
            ODGridCell gcell;
            if (tablePP.Rows.Count > 0)
            {
                //MigraDocHelper.InsertSpacer(section,5);
                par                  = section.AddParagraph();
                par.Format.Font      = MigraDocHelper.CreateFont(10, true);
                par.Format.Alignment = ParagraphAlignment.Center;
                //par.Format.SpaceBefore=Unit.FromInch(.05);
                //par.Format.SpaceAfter=Unit.FromInch(.05);
                par.AddText(Lan.g("FormRpStatement", "Payment Plans"));
                MigraDocHelper.InsertSpacer(section, 2);
                gridPP.BeginUpdate();
                gridPP.Rows.Clear();
                for (int p = 0; p < tablePP.Rows.Count; p++)
                {
                    grow = new ODGridRow();
                    grow.Cells.Add(tablePP.Rows[p]["date"].ToString());
                    grow.Cells.Add(tablePP.Rows[p]["description"].ToString());
                    grow.Cells.Add(tablePP.Rows[p]["charges"].ToString());
                    grow.Cells.Add(tablePP.Rows[p]["credits"].ToString());
                    gcell = new ODGridCell(tablePP.Rows[p]["balance"].ToString());
                    if (p == tablePP.Rows.Count - 1)
                    {
                        gcell.Bold = YN.Yes;
                    }
                    else if (tablePP.Rows[p + 1]["balance"].ToString() == "")                 //if next row balance is blank.
                    {
                        gcell.Bold = YN.Yes;
                    }
                    grow.Cells.Add(gcell);
                    gridPP.Rows.Add(grow);
                }
                gridPP.EndUpdate();
                MigraDocHelper.DrawGrid(section, gridPP);
                MigraDocHelper.InsertSpacer(section, 2);
                par                    = section.AddParagraph();
                par.Format.Font        = MigraDocHelper.CreateFont(10, true);
                par.Format.Alignment   = ParagraphAlignment.Right;
                par.Format.RightIndent = Unit.FromInch(0.25);
                double payPlanDue = 0;
                for (int m = 0; m < tableMisc.Rows.Count; m++)
                {
                    if (tableMisc.Rows[m]["descript"].ToString() == "payPlanDue")
                    {
                        payPlanDue = PIn.Double(tableMisc.Rows[m]["value"].ToString());
                    }
                }
                par.AddText(Lan.g("FormRpStatement", "Payment Plan Amount Due: ") + payPlanDue.ToString("c"));             //PatGuar.PayPlanDue.ToString("c"));
                MigraDocHelper.InsertSpacer(section, 10);
            }
            #endregion PayPlan grid
            //Body Table definition--------------------------------------------------------------------------------------------------------
            #region Body Table definition
            ODGrid gridPat = new ODGrid();
            //this.Controls.Add(gridPat);
            gridPat.BeginUpdate();
            gridPat.Columns.Clear();
            gcol = new ODGridColumn(Lan.g("FormRpStatement", "Date"), 73);
            gridPat.Columns.Add(gcol);
            gcol = new ODGridColumn(Lan.g("FormRpStatement", "Patient"), 100);
            gridPat.Columns.Add(gcol);
            //prov
            gcol = new ODGridColumn(Lan.g("FormRpStatement", "Code"), 45);
            gridPat.Columns.Add(gcol);
            gcol = new ODGridColumn(Lan.g("FormRpStatement", "Tooth"), 42);
            gridPat.Columns.Add(gcol);
            gcol = new ODGridColumn(Lan.g("FormRpStatement", "Description"), 270);
            gridPat.Columns.Add(gcol);
            gcol = new ODGridColumn(Lan.g("FormRpStatement", "Charges"), 60, HorizontalAlignment.Right);
            gridPat.Columns.Add(gcol);
            gcol = new ODGridColumn(Lan.g("FormRpStatement", "Credits"), 60, HorizontalAlignment.Right);
            gridPat.Columns.Add(gcol);
            gcol = new ODGridColumn(Lan.g("FormRpStatement", "Balance"), 60, HorizontalAlignment.Right);
            gridPat.Columns.Add(gcol);
            gridPat.Width = gridPat.WidthAllColumns + 20;
            gridPat.EndUpdate();
            #endregion Body Table definition
            //Loop through each table.  Could be one intermingled, or one for each patient-----------------------------------------
            DataTable tableAccount;
            string    tablename;
            long      patnum;
            for (int i = 0; i < dataSet.Tables.Count; i++)
            {
                tableAccount = dataSet.Tables[i];
                tablename    = tableAccount.TableName;
                if (!tablename.StartsWith("account"))
                {
                    continue;
                }
                par                    = section.AddParagraph();
                par.Format.Font        = MigraDocHelper.CreateFont(10, true);
                par.Format.SpaceBefore = Unit.FromInch(.05);
                par.Format.SpaceAfter  = Unit.FromInch(.05);
                patnum                 = 0;
                if (tablename != "account")               //account123 etc.
                {
                    patnum = PIn.Long(tablename.Substring(7));
                }
                if (patnum != 0)
                {
                    par.AddText(fam.GetNameInFamFLnoPref(patnum));
                }
                //if(FamilyStatementDataList[famIndex].PatAboutList[i].ApptDescript!=""){
                //	par=section.AddParagraph();
                //	par.Format.Font=MigraDocHelper.CreateFont(9);//same as body font
                //	par.AddText(FamilyStatementDataList[famIndex].PatAboutList[i].ApptDescript);
                //}
                gridPat.BeginUpdate();
                gridPat.Rows.Clear();
                //lineData=FamilyStatementDataList[famIndex].PatDataList[i].PatData;
                for (int p = 0; p < tableAccount.Rows.Count; p++)
                {
                    grow = new ODGridRow();
                    grow.Cells.Add(tableAccount.Rows[p]["date"].ToString());
                    grow.Cells.Add(tableAccount.Rows[p]["patient"].ToString());
                    grow.Cells.Add(tableAccount.Rows[p]["ProcCode"].ToString());
                    grow.Cells.Add(tableAccount.Rows[p]["tth"].ToString());
                    if (CultureInfo.CurrentCulture.Name == "en-AU")                   //English (Australia)
                    {
                        if (tableAccount.Rows[p]["prov"].ToString().Trim() != "")
                        {
                            grow.Cells.Add(tableAccount.Rows[p]["prov"].ToString() + " - " + tableAccount.Rows[p]["description"].ToString());
                        }
                        else                          //No provider on this account row item, so don't put the extra leading characters.
                        {
                            grow.Cells.Add(tableAccount.Rows[p]["description"].ToString());
                        }
                    }
                    else                      //Assume English (United States)
                    {
                        grow.Cells.Add(tableAccount.Rows[p]["description"].ToString());
                    }
                    grow.Cells.Add(tableAccount.Rows[p]["charges"].ToString());
                    grow.Cells.Add(tableAccount.Rows[p]["credits"].ToString());
                    grow.Cells.Add(tableAccount.Rows[p]["balance"].ToString());
                    gridPat.Rows.Add(grow);
                }
                gridPat.EndUpdate();
                MigraDocHelper.DrawGrid(section, gridPat);
                //Total
                frame = MigraDocHelper.CreateContainer(section);
                font  = MigraDocHelper.CreateFont(9, true);
                float totalPos = ((float)(doc.DefaultPageSetup.PageWidth.Inch //-doc.DefaultPageSetup.LeftMargin.Inch
                                                                              //-doc.DefaultPageSetup.RightMargin.Inch)
                                          ) * 100f) / 2f + (float)gridPat.WidthAllColumns / 2f + 7;
                RectangleF rectF = new RectangleF(0, 0, totalPos, 16);
                if (patnum != 0)
                {
                    MigraDocHelper.DrawString(frame, " ",
                                              //I decided this was unnecessary:
                                              //dataSet.Tables["patient"].Rows[fam.GetIndex(patnum)]["balance"].ToString(),
                                              font, rectF, ParagraphAlignment.Right);
                    //MigraDocHelper.DrawString(frame,FamilyStatementDataList[famIndex].PatAboutList[i].Balance.ToString("F"),font,rectF,
                    //	ParagraphAlignment.Right);
                }
            }
            gridPat.Dispose();
            //Future appointments---------------------------------------------------------------------------------------------
            #region Future appointments
            font = MigraDocHelper.CreateFont(9);
            DataTable tableAppt = dataSet.Tables["appts"];
            if (tableAppt.Rows.Count > 0)
            {
                par             = section.AddParagraph();
                par.Format.Font = font;
                par.AddText(Lan.g("FormRpStatement", "Scheduled Appointments:"));
            }
            for (int i = 0; i < tableAppt.Rows.Count; i++)
            {
                par.AddLineBreak();
                par.AddText(tableAppt.Rows[i]["descript"].ToString());
            }
            if (tableAppt.Rows.Count > 0)
            {
                MigraDocHelper.InsertSpacer(section, 10);
            }
            #endregion Future appointments
            //Note------------------------------------------------------------------------------------------------------------
            font            = MigraDocHelper.CreateFont(9);
            par             = section.AddParagraph();
            par.Format.Font = font;
            par.AddText(Stmt.Note);
            //bold note
            if (Stmt.NoteBold != "")
            {
                MigraDocHelper.InsertSpacer(section, 10);
                font            = MigraDocHelper.CreateFont(10, true, System.Drawing.Color.DarkRed);
                par             = section.AddParagraph();
                par.Format.Font = font;
                par.AddText(Stmt.NoteBold);
            }
            //return doc;
        }
示例#33
0
        /// <summary>
        /// Render table into section
        /// </summary>
        public void RenderInto(MigraDoc.DocumentObjectModel.Section section)
        {
            MigraDoc.DocumentObjectModel.Tables.Table table = section.AddTable();

            this.RenderComponents(table);
        }
示例#34
0
        private void SetInfo(Order order, ref Section section)
        {
            TextFrame frame1 = section.AddTextFrame();
            frame1.RelativeVertical = RelativeVertical.Page;
            frame1.Left = ShapePosition.Right;
            frame1.Top = new Unit(1.85, UnitType.Centimeter);
            frame1.Width = new Unit(10, UnitType.Centimeter);
            Paragraph p = frame1.AddParagraph();
            p.Format.Font.Size = 16;
            p.Format.Alignment = ParagraphAlignment.Right;
            p.AddFormattedText("Order #" + order.Id, TextFormat.Bold);

            frame1 = section.AddTextFrame();
            TextFrame frame2 = section.AddTextFrame();

            if (!String.IsNullOrWhiteSpace(_ecommerceSettings.ReportLogoImage) &&
                !_ecommerceSettings.ReportLogoImage.Contains("http"))
            {
                string logoUrl = _getLogoUrl.Get();
                if (!String.IsNullOrWhiteSpace(logoUrl))
                {
                    MigraDoc.DocumentObjectModel.Shapes.Image logo = section.AddImage(logoUrl);
                    logo.RelativeVertical = RelativeVertical.Page;
                    logo.Left = ShapePosition.Left;
                    logo.Top = new Unit(1.85, UnitType.Centimeter);
                    logo.Height = new Unit(1.5, UnitType.Centimeter);
                    frame1.MarginTop = new Unit(0.5, UnitType.Centimeter);
                    frame2.MarginTop = new Unit(0.5, UnitType.Centimeter);
                }
            }

            frame1.RelativeVertical = RelativeVertical.Page;
            frame1.Left = ShapePosition.Left;
            frame1.Top = new Unit(3.5, UnitType.Centimeter);
            frame1.Width = new Unit(10, UnitType.Centimeter);

            frame2.RelativeVertical = RelativeVertical.Page;
            frame2.Left = ShapePosition.Right;
            frame2.Top = new Unit(3.5, UnitType.Centimeter);
            frame2.Width = new Unit(8, UnitType.Centimeter);

            //BILLING AND SHIPPING
            p = frame1.AddParagraph();
            p.AddFormattedText("Bill to:", TextFormat.Bold);
            p = frame2.AddParagraph();
            p.AddFormattedText("Ship to:", TextFormat.Bold);
            p = frame1.AddParagraph();
            p.AddText(order.BillingAddress.Name);
            if (!string.IsNullOrEmpty(order.BillingAddress.Company))
            {
                p = frame1.AddParagraph();
                p.AddText(order.BillingAddress.Company);
            }

            if (order.ShippingAddress != null)
            {
                p = frame2.AddParagraph();
                p.AddText(order.ShippingAddress.Name);

                if (!string.IsNullOrEmpty(order.ShippingAddress.Company))
                {
                    p = frame2.AddParagraph();
                    p.AddText(order.ShippingAddress.Company);
                }
            }

            p = frame1.AddParagraph();
            p.AddText(order.BillingAddress.PhoneNumber);

            if (order.ShippingAddress != null)
            {
                if (!string.IsNullOrWhiteSpace(order.ShippingAddress.PhoneNumber))
                {
                    p = frame2.AddParagraph();
                    p.AddText(order.ShippingAddress.PhoneNumber);
                }
            }

            p = frame1.AddParagraph();
            p.AddText(order.BillingAddress.Address1);

            if (order.ShippingAddress != null)
            {
                if (!string.IsNullOrWhiteSpace(order.ShippingAddress.Address1))
                {
                    p = frame2.AddParagraph();
                    p.AddText(order.ShippingAddress.Address1);   
                }
            }

            if (!string.IsNullOrWhiteSpace(order.BillingAddress.Address2))
            {
                p = frame1.AddParagraph();
                p.AddText(order.BillingAddress.Address2);
            }

            if (order.ShippingAddress != null)
            {
                if (!string.IsNullOrWhiteSpace(order.ShippingAddress.Address2))
                {
                    p = frame2.AddParagraph();
                    p.AddText(order.ShippingAddress.Address2);
                }
            }

            if (!string.IsNullOrWhiteSpace(order.BillingAddress.City))
            {
                p = frame1.AddParagraph();
                p.AddText(order.BillingAddress.City);
            }

            if (order.ShippingAddress != null)
            {
                if (!string.IsNullOrWhiteSpace(order.ShippingAddress.City))
                {
                    p = frame2.AddParagraph();
                    p.AddText(order.ShippingAddress.City);
                }
            }

            if (!string.IsNullOrWhiteSpace(order.BillingAddress.StateProvince))
            {
                p = frame1.AddParagraph();
                p.AddText(order.BillingAddress.StateProvince);
            }

            if (order.ShippingAddress != null)
            {
                if (!string.IsNullOrWhiteSpace(order.ShippingAddress.StateProvince))
                {
                    p = frame2.AddParagraph();
                    p.AddText(order.ShippingAddress.StateProvince);
                }
            }

            string billingCountryName = order.BillingAddress.GetCountryName();
            if (!string.IsNullOrWhiteSpace(billingCountryName))
            {
                p = frame1.AddParagraph();
                p.AddText(billingCountryName);
            }

            if (order.ShippingAddress != null)
            {
                string shippingCountryName = order.ShippingAddress.GetCountryName();
                if (!string.IsNullOrWhiteSpace(shippingCountryName))
                {
                    p = frame2.AddParagraph();
                    p.AddText(shippingCountryName);
                }
            }

            if (!string.IsNullOrWhiteSpace(order.BillingAddress.PostalCode))
            {
                p = frame1.AddParagraph();
                p.AddText(order.BillingAddress.PostalCode);
            }

            if (order.ShippingAddress != null)
            {
                if (!string.IsNullOrWhiteSpace(order.ShippingAddress.PostalCode))
                {
                    p = frame2.AddParagraph();
                    p.AddText(order.ShippingAddress.PostalCode);
                }
            }

            frame1.AddParagraph("").AddLineBreak();
            frame2.AddParagraph("").AddLineBreak();

            //PAYMENT AND SHIPPING METHODS
            p = frame1.AddParagraph();
            p.AddText(string.Format("Payment method: {0}", order.PaymentMethod.BreakUpString()));
            p = frame2.AddParagraph();
            p.AddText(string.Format("Shipping method: {0}", order.ShippingMethodName));
        }
示例#35
0
        /// <summary>
        /// Creates the static parts of the invoice.
        /// </summary>
        void CreatePage()
        {
            // Each MigraDoc document needs at least one section.
            Section section = this.document.AddSection();

            // Put a logo in the header
            Image image = section.AddImage(path);

            image.Top              = ShapePosition.Top;
            image.Left             = ShapePosition.Left;
            image.WrapFormat.Style = WrapStyle.Through;

            // Create footer
            Paragraph paragraph = section.Footers.Primary.AddParagraph();

            paragraph.AddText("Health And Social Services.");
            paragraph.Format.Font.Size = 9;
            paragraph.Format.Alignment = ParagraphAlignment.Center;

            // Create the text frame for the address
            this.addressFrame                    = section.AddTextFrame();
            this.addressFrame.Height             = "3.0cm";
            this.addressFrame.Width              = "7.0cm";
            this.addressFrame.Left               = ShapePosition.Left;
            this.addressFrame.RelativeHorizontal = RelativeHorizontal.Margin;
            this.addressFrame.Top                = "5.0cm";
            this.addressFrame.RelativeVertical   = RelativeVertical.Page;

            // Put sender in address frame
            paragraph = this.addressFrame.AddParagraph("Karachi,Pakistan");
            paragraph.Format.Font.Name  = "Times New Roman";
            paragraph.Format.Font.Size  = 7;
            paragraph.Format.SpaceAfter = 3;

            // Add the print date field
            paragraph = section.AddParagraph();
            paragraph.Format.SpaceBefore = "6cm";
            paragraph.Style = "Reference";
            paragraph.AddFormattedText("Patients Detail", TextFormat.Bold);
            paragraph.AddTab();
            paragraph.AddText("Date, ");
            paragraph.AddDateField("dd.MM.yyyy");

            // Create the item table
            this.table                     = section.AddTable();
            this.table.Style               = "Table";
            this.table.Borders.Color       = TableBorder;
            this.table.Borders.Width       = 0.25;
            this.table.Borders.Left.Width  = 0.5;
            this.table.Borders.Right.Width = 0.5;
            this.table.Rows.LeftIndent     = 0;



            // Before you can add a row, you must define the columns
            Column column;

            foreach (DataColumn col in dt.Columns)
            {
                column = this.table.AddColumn(Unit.FromCentimeter(3));
                column.Format.Alignment = ParagraphAlignment.Center;
            }

            // Create the header of the table
            Row row = table.AddRow();

            row.HeadingFormat    = true;
            row.Format.Alignment = ParagraphAlignment.Center;
            row.Format.Font.Bold = true;
            row.Shading.Color    = TableBlue;


            for (int i = 0; i < dt.Columns.Count; i++)
            {
                row.Cells[i].AddParagraph(dt.Columns[i].ColumnName);
                row.Cells[i].Format.Font.Bold  = false;
                row.Cells[i].Format.Alignment  = ParagraphAlignment.Left;
                row.Cells[i].VerticalAlignment = VerticalAlignment.Bottom;
            }

            this.table.SetEdge(0, 0, dt.Columns.Count, 1, Edge.Box, BorderStyle.Single, 0.75, Color.Empty);
        }
示例#36
0
 private void SetFooter(ref Section section)
 {
     if (!String.IsNullOrWhiteSpace(_ecommerceSettings.ReportFooterText))
     {
         Paragraph p = section.Footers.Primary.AddParagraph();
         p.Format.Alignment = ParagraphAlignment.Left;
         p.Format.Font.Size = 8;
         p.AddText(_ecommerceSettings.ReportFooterText);
     }
 }
示例#37
0
        //
        // All Public Methods.
        //


        public void AddNewPage()
        {
            this._section = _doc.AddSection();
        }
示例#38
0
 public PdfReport(Section s)
 {
     if (s == null) throw new ArgumentNullException("s");
     _Document = s.Document;
     _Section = s;
 }
示例#39
0
        public IActionResult OnGet(string pdf)
        {
            //get the session first!
            UserName  = HttpContext.Session.GetString(SessionKeyName1);
            FirstName = HttpContext.Session.GetString(SessionKeyName2);
            SessionID = HttpContext.Session.GetString(SessionKeyName3);


            DatabaseConnect dbstring     = new DatabaseConnect();     //creating an object from the class
            string          DbConnection = dbstring.DatabaseString(); //calling the method from the class

            Console.WriteLine(DbConnection);
            SqlConnection conn = new SqlConnection(DbConnection);

            conn.Open();

            using (SqlCommand command = new SqlCommand())
            {
                command.Connection  = conn;
                command.CommandText = @"SELECT EmployeeID,
                                        EmpFName + ' ' + EmpLName AS EmployeeName,
                                        EmpDoB AS EmployeeBornOn,
                                        EmpHireDate AS EmployedOn
                                        FROM EmployeesTable;";

                var reader = command.ExecuteReader();

                Employee = new List <Employee>();
                while (reader.Read())
                {
                    Employee Row = new Employee(); //each record found from the table
                    Row.EmployeeId        = reader.GetInt32(0);
                    Row.EmployeeFirstName = reader.GetString(1);
                    Row.EmployeeDoB       = reader.GetDateTime(2);
                    Row.EmployeeDateHired = reader.GetDateTime(3);
                    Employee.Add(Row);
                }
            }


            //PDF code here!
            if (pdf == "1")
            {
                //Create an object for pdf document
                Document  doc  = new Document();
                Section   sec  = doc.AddSection();
                Paragraph para = sec.AddParagraph();

                para.Format.Font.Name  = "Arial";
                para.Format.Font.Size  = 14;
                para.Format.Font.Color = Color.FromCmyk(0, 0, 0, 100); //black colour
                para.AddFormattedText("List of Employees", TextFormat.Bold);
                para.Format.SpaceAfter = "1.0cm";

                para.AddFormattedText();

                //Table
                Table tab = new Table();
                tab.Borders.Width = 0.75;
                tab.TopPadding    = 5;
                tab.BottomPadding = 5;

                //Column
                Column col = tab.AddColumn(Unit.FromCentimeter(3));
                col.Format.Alignment = ParagraphAlignment.Center;
                tab.AddColumn(Unit.FromCentimeter(3));
                tab.AddColumn(Unit.FromCentimeter(3));
                tab.AddColumn(Unit.FromCentimeter(3));
                //tab.AddColumn(Unit.FromCentimeter(3));


                //Row
                Row row = tab.AddRow();
                row.Shading.Color = Colors.Coral;//select your preference colour!

                //Cell for header
                Cell cell = new Cell();
                cell = row.Cells[0];
                cell.AddParagraph("EmployeeID");
                cell = row.Cells[1];
                cell.AddParagraph("Employee First Name");
                cell = row.Cells[2];
                cell.AddParagraph("Employee Date of Birth");
                cell = row.Cells[3];
                cell.AddParagraph("Employee Hire Date");

                //Add data to table
                for (int i = 0; i < Employee.Count; i++)
                {
                    row  = tab.AddRow();
                    cell = row.Cells[0];
                    cell.AddParagraph(Convert.ToString(i + 1));
                    cell = row.Cells[1];
                    cell.AddParagraph(Employee[i].EmployeeFirstName);
                    cell = row.Cells[2];
                    cell.AddParagraph(Convert.ToString(Employee[i].EmployeeDateHired));
                    cell = row.Cells[3];
                    cell.AddParagraph(Convert.ToString(Employee[i].EmployeeDoB));
                }

                tab.SetEdge(0, 0, 4, (Employee.Count + 1), Edge.Box, BorderStyle.Single, 1.5, Colors.Black);
                sec.Add(tab);

                //Rendering
                PdfDocumentRenderer pdfRen = new PdfDocumentRenderer();
                pdfRen.Document = doc;
                pdfRen.RenderDocument();

                //Create a memory stream
                MemoryStream stream = new MemoryStream();
                pdfRen.PdfDocument.Save(stream); //saving the file into the stream

                Response.Headers.Add("content-disposition", new[] { "inline; filename = ListofEmployees.pdf" });
                return(File(stream, "application/pdf"));
            }
            return(Page());
        }
示例#40
0
 public Section(MigraDoc.DocumentObjectModel.Section section)
 {
     ThisSection = section;
     ThisSection.PageSetup.LeftMargin  = "2cm";
     ThisSection.PageSetup.RightMargin = "2cm";
 }
示例#41
0
 protected virtual void NewSection()
 {
     _Section = Document.AddSection();
 }
示例#42
0
        public void CreateCharacterCertificatePDF(string[] CertificateData, string admNo, int admYear)
        {
            if (CertificateData.Length != 5)
            {
                return;
            }
            else
            {
                // Generate nmhs-nexap directory in my document folder
                string containerfolder  = this.GenerateDocumentBaseDirectory();
                MigraModel.Document doc = new MigraModel.Document();
                MigraModel.Section  sec = doc.AddSection();
                sec.PageSetup           = doc.DefaultPageSetup.Clone();
                sec.PageSetup.TopMargin = ".7cm";

                MigraDoc.DocumentObjectModel.Shapes.TextFrame tframe = sec.AddTextFrame();
                tframe.AddImage("nmhs-logo.jpg");
                tframe.Left               = "-.5cm";
                tframe.Top                = "0.7cm";
                tframe.RelativeVertical   = MigraModel.Shapes.RelativeVertical.Page;
                tframe.RelativeHorizontal = MigraModel.Shapes.RelativeHorizontal.Margin;

                MigraModel.Paragraph paraSchoolName = sec.AddParagraph();
                paraSchoolName.Format.Font.Name  = "Times New Roman";
                paraSchoolName.Format.Alignment  = MigraModel.ParagraphAlignment.Center;
                paraSchoolName.Format.Font.Size  = 25;
                paraSchoolName.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.DarkBlue;
                string schoolName = "NAIMOUZA HIGH SCHOOL";
                paraSchoolName.AddFormattedText(schoolName, MigraModel.TextFormat.Bold);

                MigraModel.Paragraph paraSchoolAddress = sec.AddParagraph();
                paraSchoolAddress.Format.Font.Size = 14;
                paraSchoolAddress.Format.Alignment = MigraModel.ParagraphAlignment.Center;
                string addrs = "Vill. & P.O. Sujapur, Dist. Malda, 732206";
                paraSchoolAddress.AddText(addrs);

                MigraModel.Paragraph paraSchoolMeta = sec.AddParagraph();
                paraSchoolMeta.Format.Font.Size = 10;
                paraSchoolMeta.Format.Alignment = MigraModel.ParagraphAlignment.Center;
                string meta = "INDEX NO. - R1-110, CONTACT NO. - 03512-246525";
                paraSchoolMeta.AddFormattedText(meta, MigraModel.TextFormat.NotBold);

                MigraModel.Paragraph paraAdmissionMeta = sec.AddParagraph();
                paraAdmissionMeta.Format.Font.Size = 10;
                paraAdmissionMeta.Format.Alignment = MigraModel.ParagraphAlignment.Right;
                string admYr = (admYear != 0) ? admYear.ToString() : "0000";
                string ameta = "Admission Sl. " + admNo + " of " + admYr;
                paraAdmissionMeta.AddFormattedText(ameta, MigraModel.TextFormat.Bold);

                MigraModel.Paragraph paraCertificateType = sec.AddParagraph();
                paraCertificateType.Format.Font.Size = 18;
                paraCertificateType.Format.Alignment = MigraModel.ParagraphAlignment.Center;
                paraCertificateType.AddLineBreak();
                string ctype = "CHARACTER CERTIFICATE";
                paraCertificateType.AddFormattedText(ctype, MigraModel.TextFormat.NotBold);

                MigraModel.Paragraph para_a = sec.AddParagraph();
                para_a.Format.Font.Name  = "Lucida Handwriting";
                para_a.Format.Font.Size  = 16;
                para_a.Format.Font.Color = MigraModel.Colors.DarkBlue;
                para_a.Format.Alignment  = MigraModel.ParagraphAlignment.Justify;
                para_a.AddLineBreak();
                para_a.AddLineBreak();
                para_a.AddLineBreak();
                para_a.AddLineBreak();
                para_a.AddTab();

                string para_aText, para_aTextb, paraTextc, paraTextd, stdName;
                para_aText  = CertificateData[0].Trim();
                para_aTextb = CertificateData[1].Trim();
                paraTextc   = CertificateData[2].Trim();
                paraTextd   = CertificateData[3].Trim();
                stdName     = CertificateData[4].Trim();

                para_a.AddText(para_aText);

                MigraModel.Paragraph para_b = sec.AddParagraph();
                para_b.Format.Font.Name  = "Lucida Handwriting";
                para_b.Format.Font.Size  = 16;
                para_b.Format.Font.Color = MigraModel.Colors.DarkBlue;
                para_b.Format.Alignment  = MigraModel.ParagraphAlignment.Justify;
                para_b.AddLineBreak();
                para_b.AddTab();
                para_b.AddText(para_aTextb);

                MigraModel.Paragraph para_c = sec.AddParagraph();
                para_c.Format.Font.Name  = "Lucida Handwriting";
                para_c.Format.Font.Size  = 16;
                para_c.Format.Font.Color = MigraModel.Colors.DarkBlue;
                para_c.Format.Alignment  = MigraModel.ParagraphAlignment.Justify;
                para_c.AddLineBreak();
                para_c.AddTab();
                para_c.AddText(paraTextc);

                MigraModel.Paragraph para_d = sec.AddParagraph();
                para_d.Format.Font.Name  = "Lucida Handwriting";
                para_d.Format.Font.Size  = 16;
                para_d.Format.Font.Color = MigraModel.Colors.DarkBlue;
                para_d.Format.Alignment  = MigraModel.ParagraphAlignment.Justify;
                para_d.AddLineBreak();
                para_d.AddTab();
                para_d.AddText(paraTextd);


                MigraDoc.DocumentObjectModel.Shapes.TextFrame tframeHMaster = sec.AddTextFrame();
                MigraModel.Paragraph paraHMaster = tframeHMaster.AddParagraph();
                paraHMaster.Format.Font.Size = "14";
                paraHMaster.Format.Alignment = MigraModel.ParagraphAlignment.Center;
                string txt1 = "Headmaster";
                string txt2 = "Naimuza High School";
                string txt3 = "Sujapur, Malda";
                paraHMaster.AddText(txt1);
                paraHMaster.AddLineBreak();
                paraHMaster.AddText(txt2);
                paraHMaster.AddLineBreak();
                paraHMaster.AddText(txt3);
                tframeHMaster.Width              = "6cm";
                tframeHMaster.Left               = "10cm";
                tframeHMaster.Top                = "19cm";
                tframeHMaster.RelativeVertical   = MigraModel.Shapes.RelativeVertical.Page;
                tframeHMaster.RelativeHorizontal = MigraModel.Shapes.RelativeHorizontal.Margin;

                MigraDoc.Rendering.PdfDocumentRenderer docRend = new MigraDoc.Rendering.PdfDocumentRenderer(false);
                docRend.Document = doc;
                try
                {
                    docRend.RenderDocument();
                }
                catch (Exception e)
                {
                    System.Windows.MessageBox.Show(e.Message);
                    return;
                }
                string fname      = "CHR_" + stdName + DateTime.Now.ToString("yyyy-MM-dd HHmmss") + ".pdf";
                string pathString = Path.Combine(containerfolder, fname);
                docRend.PdfDocument.Save(pathString);

                System.Diagnostics.ProcessStartInfo processInfo = new System.Diagnostics.ProcessStartInfo();
                processInfo.FileName = pathString;
                System.Diagnostics.Process.Start(processInfo);
            }
        }
示例#43
0
 /// <summary>
 /// Adds a new section to the document.
 /// </summary>
 public void Add(Section section)
 {
   this.Sections.Add(section);
 }
示例#44
0
        private Rectangle GetFooterArea(Section section, int page)
        {
            PageSetup pageSetup = section.PageSetup;
            XUnit xPos;
            if (pageSetup.MirrorMargins && page % 2 == 0)
                xPos = pageSetup.RightMargin.Point;
            else
                xPos = pageSetup.LeftMargin.Point;

            XUnit width = pageSetup.EffectivePageWidth.Point;
            width -= pageSetup.LeftMargin + pageSetup.RightMargin;
            XUnit yPos = pageSetup.EffectivePageHeight.Point;

            yPos -= pageSetup.BottomMargin.Point;
            XUnit height = pageSetup.BottomMargin - pageSetup.FooterDistance;
            return new Rectangle(xPos, yPos, width, height);
        }
示例#45
0
        /// <summary>Creates the graph.</summary>
        /// <param name="writer">The writer.</param>
        /// <param name="graphAndTable">The graph and table to convert to html.</param>
        /// <param name="workingDirectory">The working directory.</param>
        private void CreateGraphPDF(Section section, AutoDocumentation.GraphAndTable graphAndTable, string workingDirectory)
        {
            // Create a 2 column, 1 row table. Image in first cell, X/Y data in second cell.
            Table table = section.AddTable();
            table.Style = "GraphAndTable";
            table.Rows.LeftIndent = graphAndTable.indent + "cm";

            Column column1 = table.AddColumn();
            column1.Width = "8cm";
            //column1.Format.Alignment = ParagraphAlignment.Right;
            Column column2 = table.AddColumn();
            column2.Width = "8cm";
            //column2.Format.Alignment = ParagraphAlignment.Right;
            Row row = table.AddRow();

            // Ensure graphs directory exists.
            string graphDirectory = Path.Combine(workingDirectory, "Graphs");
            Directory.CreateDirectory(graphDirectory);

            // Determine the name of the .png file to write.
            string PNGFileName = Path.Combine(graphDirectory,
                                              graphAndTable.xyPairs.Parent.Parent.Name + graphAndTable.xyPairs.Parent.Name + ".png");

            // Setup graph.
            GraphView graph = new GraphView();
            graph.Clear();

            // Create a line series.
            graph.DrawLineAndMarkers("", graphAndTable.xyPairs.X, graphAndTable.xyPairs.Y,
                                     Models.Graph.Axis.AxisType.Bottom, Models.Graph.Axis.AxisType.Left,
                                     System.Drawing.Color.Blue, Models.Graph.LineType.Solid, Models.Graph.MarkerType.None,
                                     Models.Graph.LineThicknessType.Normal, Models.Graph.MarkerSizeType.Normal, true);

            // Format the axes.
            graph.FormatAxis(Models.Graph.Axis.AxisType.Bottom, graphAndTable.xName, false, double.NaN, double.NaN, double.NaN);
            graph.FormatAxis(Models.Graph.Axis.AxisType.Left, graphAndTable.yName, false, double.NaN, double.NaN, double.NaN);
            graph.BackColor = System.Drawing.Color.White;
            graph.FontSize = 10;
            graph.Refresh();

            // Export graph to bitmap file.
            Bitmap image = new Bitmap(400, 250);
            graph.Export(image, false);
            image.Save(PNGFileName, System.Drawing.Imaging.ImageFormat.Png);
            MigraDoc.DocumentObjectModel.Shapes.Image image1 = row.Cells[0].AddImage(PNGFileName);

            // Add x/y data.
            Paragraph xyParagraph = row.Cells[1].AddParagraph();
            xyParagraph.Style = "xyStyle";
            AddFixedWidthText(xyParagraph, "X", 10);
            AddFixedWidthText(xyParagraph, "Y", 10);
            xyParagraph.AddLineBreak();
            for (int i = 0; i < graphAndTable.xyPairs.X.Length; i++)
            {

                AddFixedWidthText(xyParagraph, graphAndTable.xyPairs.X[i].ToString(), 10);
                AddFixedWidthText(xyParagraph, graphAndTable.xyPairs.Y[i].ToString(), 10);
                xyParagraph.AddLineBreak();
            }

            // Add an empty paragraph for spacing.
            Paragraph spacing = section.AddParagraph();
        }
示例#46
0
        /// <summary>Creates the table.</summary>
        /// <param name="section">The section.</param>
        /// <param name="tableObj">The table to convert to html.</param>
        /// <param name="workingDirectory">The working directory.</param>
        private void CreateTable(Section section, AutoDocumentation.Table tableObj, string workingDirectory)
        {
            // Create a 2 column, 1 row table. Image in first cell, X/Y data in second cell.
            Table table = section.AddTable();
            table.Style = "Table";
            table.Rows.LeftIndent = "1cm";

            foreach (List<string> column in tableObj.data)
            {
                Column column1 = table.AddColumn();
                column1.Width = "1.4cm";
                column1.Format.Alignment = ParagraphAlignment.Right;
            }

            for (int rowIndex = 0; rowIndex < tableObj.data[0].Count; rowIndex++)
            {
                Row row = table.AddRow();
                for (int columnIndex = 0; columnIndex < tableObj.data.Count; columnIndex++)
                {
                    string cellText = tableObj.data[columnIndex][rowIndex];
                    row.Cells[columnIndex].AddParagraph(cellText);
                }

            }
        }
示例#47
0
        /// <summary>Adds a formatted paragraph to section.</summary>
        /// <param name="section">The section.</param>
        /// <param name="paragraph">The paragraph.</param>
        private void AddFormattedParagraphToSection(Section section, AutoDocumentation.Paragraph paragraph)
        {
            MarkdownDeep.Markdown markDown = new MarkdownDeep.Markdown();
            markDown.ExtraMode = true;
            string html = markDown.Transform(paragraph.text);

            string imageDirectory = Path.GetDirectoryName(ExplorerPresenter.ApsimXFile.FileName);
            HtmlToMigraDoc.Convert(html, section, imageDirectory);

            Paragraph para = section.LastParagraph;
            para.Format.LeftIndent = Unit.FromCentimeter(paragraph.indent);
            if (paragraph.bookmarkName != null)
                para.AddBookmark(paragraph.bookmarkName);
            if (paragraph.handingIndent)
            {
                para.Format.LeftIndent = "1cm";
                para.Format.FirstLineIndent = "-1cm";
            }
        }
示例#48
0
		protected GeneriqueDocument(Document document, DonneesDocument donnees) {
			this._document = document;
			this._page = this._document.AddSection();
			this._donnees = donnees;
		}
示例#49
0
        /// <summary>
        /// Render a paragraph into a section
        /// </summary>
        public override void RenderInto(MigraDoc.DocumentObjectModel.Section section)
        {
            MigraDoc.DocumentObjectModel.Paragraph paragraph = this.Create();

            section.Add(paragraph);
        }
示例#50
0
        private void SetHeader(ref Section section)
        {
            TextFrame frame1 = section.Headers.Primary.AddTextFrame();
            frame1.RelativeVertical = RelativeVertical.Page;
            frame1.Left = ShapePosition.Left;
            frame1.MarginTop = new Unit(1, UnitType.Centimeter);
            frame1.Width = new Unit(10, UnitType.Centimeter);

            TextFrame frame2 = section.Headers.Primary.AddTextFrame();
            frame2.RelativeVertical = RelativeVertical.Page;
            frame2.Left = ShapePosition.Right;
            frame2.MarginTop = new Unit(1, UnitType.Centimeter);
            frame2.Width = new Unit(2, UnitType.Centimeter);

            Paragraph p = frame1.AddParagraph();
            p.AddFormattedText(CurrentRequestData.CurrentSite.Name, TextFormat.Bold);
            p = frame2.AddParagraph();
            p.AddDateField("dd/MM/yyyy");
        }
示例#51
-1
 private void addPage(Section section, string imgPaths)
 {
     Image image = section.AddImage(imgPaths);
     image.Width = "21cm";
     image.LockAspectRatio = true;
     image.RelativeVertical = RelativeVertical.Page;
     image.RelativeHorizontal = RelativeHorizontal.Page;
     image.WrapFormat.Style = WrapStyle.Through;
 }
示例#52
-1
        private Table SetTableStyle(ref Section section, Color tableColor)
        {
            TextFrame frame = section.AddTextFrame();
            frame.MarginTop = new Unit(6, UnitType.Centimeter);
            frame.Width = new Unit(16, UnitType.Centimeter);

            //TABLE LABEL
            Paragraph p = frame.AddParagraph();
            p.AddFormattedText("Purchased goods:", TextFormat.Bold);

            frame.AddParagraph("").AddLineBreak();

            //TABLE
            Table table = frame.AddTable();
            table.Style = "Table";
            table.Borders.Color = tableColor;
            table.Borders.Width = 0.25;
            table.Borders.Left.Width = 0.5;
            table.Borders.Right.Width = 0.5;
            table.Rows.LeftIndent = 0;
            return table;
        }