Beispiel #1
1
        public static Table CreateMergedDownTable(string[] strArrayHeader, string[] strArrayHeaderSize, string[][] strMatrixContent, int[][] matrixMergeDown, string fontName, Color fontColor, Color shadeColor, Unit fontSize, double borderSize, double edgeSize, bool isHeaderBold, string imageWidth)
        {
            Table table = new Table();
            table.Borders.Width = borderSize;

            for (int i = 0; i < strArrayHeader.GetLength(0); i++)
            {
                table.AddColumn(strArrayHeaderSize[i]);
            }

            Row row = table.AddRow();
            row.Format.Alignment = ParagraphAlignment.Center;
            row.Format.Font.Bold = isHeaderBold;
            row.Format.Font.Name = fontName;
            row.Format.Font.Color = fontColor;
            row.Format.Font.Size = fontSize;
            row.Shading.Color = shadeColor;
            row.VerticalAlignment = VerticalAlignment.Center;

            Cell cell;

            for (int i = 0; i < strArrayHeader.GetLength(0); i++)
            {
                cell = row.Cells[i];
                cell.AddParagraph(strArrayHeader[i]);
            }

            for (int i = 0; i < strMatrixContent.GetLength(0); i++)
            {
                row = table.AddRow();
                row.Format.Alignment = ParagraphAlignment.Left;
                row.Format.Font.Bold = false;
                row.Format.Font.Name = fontName;
                row.Format.Font.Color = fontColor;
                row.Format.Font.Size = fontSize;

                string[] strArrayContent = strMatrixContent[i];

                for (int j = 0; j < strArrayContent.GetLength(0); j++)
                {
                    cell = row.Cells[j];
                    cell.MergeDown = matrixMergeDown[i][j];
                    if (strArrayContent[j].Contains(".jpg") || strArrayContent[j].Contains(".png"))
                    {
                        Image image = new Image(strArrayContent[j]);
                        image.Width = imageWidth;
                        cell.Add(image);
                    }
                    else
                    {
                        cell.AddParagraph(strArrayContent[j]);
                    }
                }
            }

            table.SetEdge(0, 0, strArrayHeader.GetLength(0), strMatrixContent.GetLength(0) + 1, Edge.Box, BorderStyle.Single, edgeSize, Colors.Black);
            return table;
        }
Beispiel #2
0
    public static void DemonstrateSimpleTable(Document document)
    {
      document.LastSection.AddParagraph("Simple Tables", "Heading2");

      Table table = new Table();
      table.Borders.Width = 0.75;

      Column column = table.AddColumn(Unit.FromCentimeter(2));
      column.Format.Alignment = ParagraphAlignment.Center;

      table.AddColumn(Unit.FromCentimeter(5));

      Row row = table.AddRow();
      row.Shading.Color = Colors.PaleGoldenrod;
      Cell cell = row.Cells[0];
      cell.AddParagraph("Itemus");
      cell = row.Cells[1];
      cell.AddParagraph("Descriptum");

      row = table.AddRow();
      cell = row.Cells[0];
      cell.AddParagraph("1");
      cell = row.Cells[1];
      cell.AddParagraph(FillerText.ShortText);

      row = table.AddRow();
      cell = row.Cells[0];
      cell.AddParagraph("2");
      cell = row.Cells[1];
      cell.AddParagraph(FillerText.Text);

      table.SetEdge(0, 0, 2, 3, Edge.Box, BorderStyle.Single, 1.5, Colors.Black);

      document.LastSection.Add(table);
    }
Beispiel #3
0
        private Table SetUpKampftabelle()
        {
            Table table = new Table();

            table.Style                  = CustomStyles.TABLEKLEIN;
            table.Borders.Color          = Colors.Black;
            table.Borders.Width          = 0.25;
            table.Borders.Left.Width     = 0.25;
            table.Borders.Right.Width    = 0.25;
            table.Rows.LeftIndent        = 0;
            table.Rows.VerticalAlignment = VerticalAlignment.Center;

            double breite_KampfNr        = 1.2;
            double breite_Gewichtsklasse = 1;
            double breite_Name           = 3;

            Column column = table.AddColumn($"{breite_KampfNr}cm");

            column.Format.Alignment = ParagraphAlignment.Right;

            column = table.AddColumn($"{breite_Gewichtsklasse}cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = table.AddColumn($"{breite_Name}cm");
            column.Format.Alignment = ParagraphAlignment.Left;

            column = table.AddColumn($"{breite_Name}cm");
            column.Format.Alignment = ParagraphAlignment.Left;

            return(table);
        }
        private void Columns(Table table)
        {
            // Before you can add a row, you must define the columns
            var column = table.AddColumn("5.5cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            for (var i = 0; i < 4; i++)
            {
                table.AddColumn("2cm").Format.Alignment = ParagraphAlignment.Right;
            }
        }
        public TableOfContents(MigraDoc.DocumentObjectModel.Tables.Table table)
            : base(table)
        {
            var labelColumn = table.AddColumn("18cm");

            labelColumn.Format.Alignment = ParagraphAlignment.Left;
        }
        public Table1Column(MigraDoc.DocumentObjectModel.Tables.Table table)
            : base(table)
        {
            var column = table.AddColumn("18cm");

            column.Format.Alignment = ParagraphAlignment.Left;
        }
Beispiel #7
0
        private Table SetUpKampftabelle(double randLinksRechts)
        {
            Table table = new Table();

            table.Style                  = CustomStyles.TABLEKLEIN;
            table.Borders.Color          = Colors.Black;
            table.Borders.Width          = 0.25;
            table.Borders.Left.Width     = 0.25;
            table.Borders.Right.Width    = 0.25;
            table.Rows.LeftIndent        = 0;
            table.Rows.VerticalAlignment = VerticalAlignment.Center;

            // Before you can add a row, you must define the columns
            double a4LandscapeBreite = (29.7 - 2 * randLinksRechts);

            double breite_KampfNr        = 1.2;
            double breite_Gewichtsklasse = 1;
            double breite_Name           = 3;

            double breite_Sieger = 2;


            double breite_Unterschrift = a4LandscapeBreite - breite_KampfNr - breite_Gewichtsklasse - 2 * breite_Name - _breite_Wertungen - breite_Sieger - _breite_Siegart;

            Column column = table.AddColumn($"{breite_KampfNr}cm");

            column.Format.Alignment = ParagraphAlignment.Right;

            column = table.AddColumn($"{breite_Gewichtsklasse}cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = table.AddColumn($"{breite_Name}cm");
            column.Format.Alignment = ParagraphAlignment.Left;

            column = table.AddColumn($"{breite_Name}cm");
            column.Format.Alignment = ParagraphAlignment.Left;

            column = table.AddColumn($"{_breite_Wertungen}cm");
            column.Format.Alignment = ParagraphAlignment.Left;

            column = table.AddColumn($"{breite_Sieger}cm");
            column.Format.Alignment = ParagraphAlignment.Left;

            column = table.AddColumn($"{_breite_Siegart}cm");
            column.Format.Alignment = ParagraphAlignment.Left;

            column = table.AddColumn($"{breite_Unterschrift}cm");
            column.Format.Alignment = ParagraphAlignment.Left;

            return(table);
        }
Beispiel #8
0
        private Table KampfInfos(MannschaftskampfViewModel mannschaftskampfViewModel, CompetitionInfosViewModel zusatzInfos)
        {
            var table = new Table();

            table.Style = CustomStyles.TABLEINFO;

            double a4LandscapeBreite = (29.7 - 2 * _randLinksRechts) / 3.0;

            Column column = table.AddColumn($"{a4LandscapeBreite - 2}cm");

            column.Format.Alignment = ParagraphAlignment.Left;

            column = table.AddColumn($"{a4LandscapeBreite + 4}cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            column = table.AddColumn($"{a4LandscapeBreite - 2}cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            Row zeile = table.AddRow();

            var spalte = zeile.Cells[0].AddParagraph();
            var ft     = spalte.AddFormattedText($"{mannschaftskampfViewModel.LigaId} {mannschaftskampfViewModel.TableId}", TextFormat.Bold);

            ft.Font.Size = CustomStyles.fontSizeNormal;
            ft.Font.Name = CustomStyles.fontUeberschriften;

            spalte       = zeile.Cells[1].AddParagraph();
            ft           = spalte.AddFormattedText($"{zusatzInfos.Kampfart} {mannschaftskampfViewModel.HeimMannschaft} vs. {mannschaftskampfViewModel.GastMannschaft}", TextFormat.Bold);
            ft.Font.Size = CustomStyles.fontSizeNormal;
            ft.Font.Name = CustomStyles.fontUeberschriften;

            spalte       = zeile.Cells[2].AddParagraph();
            ft           = spalte.AddFormattedText($"{mannschaftskampfViewModel.Kampfdatum.ToShortDateString()}", TextFormat.Bold);
            ft.Font.Size = CustomStyles.fontSizeNormal;
            ft.Font.Name = CustomStyles.fontUeberschriften;

            return(table);
        }
        private static void AddHeaders(Table table, string optionalHeader, bool includeSite)
        {
            //Headers
            // Create a font
            var font = new Font("Arial", 8);

            table.Borders.Width = 0.25;

            if (includeSite)
            {
                table.AddColumn(Unit.FromMillimeter(25));
                table.AddColumn(Unit.FromMillimeter(25));
                table.AddColumn(Unit.FromMillimeter(27));
                table.AddColumn(Unit.FromMillimeter(27));
                table.AddColumn(Unit.FromMillimeter(27));
                table.AddColumn(Unit.FromCentimeter(4));
                table.AddColumn(Unit.FromMillimeter(21));
            }
            else
            {
                table.AddColumn(Unit.FromCentimeter(3));
                table.AddColumn(Unit.FromMillimeter(28));
                table.AddColumn(Unit.FromMillimeter(28));
                table.AddColumn(Unit.FromMillimeter(28));
                table.AddColumn(Unit.FromMillimeter(28));
                table.AddColumn(Unit.FromCentimeter(5));
            }

            if(optionalHeader != null)
                AddRoleHeader(table, optionalHeader, includeSite);

            var row = table.AddRow();
            row.HeadingFormat = true;
            row.Format.Font.ApplyFont(font);
            row.Format.Font.Bold = true;
            row.Shading.Color = Colors.PaleGoldenrod;
            var cell = row.Cells[0];
            cell.AddParagraph("Surname");
            cell = row.Cells[1];
            cell.AddParagraph("Firstname");
            cell = row.Cells[2];
            cell.AddParagraph("Home");
            cell = row.Cells[3];
            cell.AddParagraph("Work");
            cell = row.Cells[4];
            cell.AddParagraph("Cell");
            cell = row.Cells[5];
            cell.AddParagraph("Email");
            if (!includeSite) return;
            cell = row.Cells[6];
            cell.AddParagraph("Site");
        }
Beispiel #10
0
    private void generatePDFFile()
    {
        // Create a MigraDoc document
        Document doc = new Document();

        doc.Info.Title   = "Pesanan Agihan";
        doc.Info.Subject = "Order No:" + oModOrder.GetSetorderno;
        doc.Info.Author  = "ZMartPartner System";

        //set page orientation
        doc.DefaultPageSetup.Orientation    = MigraDoc.DocumentObjectModel.Orientation.Portrait;
        doc.DefaultPageSetup.TopMargin      = "7.5cm"; //120
        doc.DefaultPageSetup.BottomMargin   = "8.5cm"; //150
        doc.DefaultPageSetup.LeftMargin     = 40;
        doc.DefaultPageSetup.RightMargin    = 40;
        doc.DefaultPageSetup.HeaderDistance = "1.5cm"; //20
        doc.DefaultPageSetup.FooterDistance = "1cm";   //20

        MigraDoc.DocumentObjectModel.Style style = doc.Styles["Normal"];
        // Because all styles are derived from Normal, the next line changes the
        // font of the whole document. Or, more exactly, it changes the font of
        // all styles and paragraphs that do not redefine the font.
        style.Font.Name = "Verdana";

        // Create a new style called Table based on style Normal
        style           = doc.Styles.AddStyle("Table", "Normal");
        style.Font.Name = "Verdana";
        style.Font.Name = "Arial";
        style.Font.Size = 8;

        // Each MigraDoc document needs at least one section.
        Section section = doc.AddSection();

        // Put 1st logo in the header
        string logo_lima = Server.MapPath("~/images/" + modCompInfo.GetSetcomp_logo1);

        MigraDoc.DocumentObjectModel.Shapes.Image image = section.Headers.Primary.AddImage(logo_lima);
        image.Height             = "1cm";
        image.LockAspectRatio    = true;
        image.RelativeVertical   = RelativeVertical.Line;
        image.RelativeHorizontal = RelativeHorizontal.Margin;
        image.Top              = ShapePosition.Top;
        image.Left             = ShapePosition.Right;
        image.WrapFormat.Style = WrapStyle.Through;

        // Put 2nd logo in the header
        string logo_mod = Server.MapPath("~/images/" + modCompInfo.GetSetcomp_logo2);

        MigraDoc.DocumentObjectModel.Shapes.Image image2 = section.Headers.Primary.AddImage(logo_mod);
        image2.Height             = "1cm";
        image2.LockAspectRatio    = true;
        image2.RelativeVertical   = RelativeVertical.Line;
        image2.RelativeHorizontal = RelativeHorizontal.Margin;
        image2.Top              = ShapePosition.Top;
        image2.Left             = ShapePosition.Left;
        image2.WrapFormat.Style = WrapStyle.Through;

        // Create Header
        Paragraph header = section.Headers.Primary.AddParagraph();

        header.AddText("PESANAN AGIHAN");
        header.Format.Font.Size = 12;
        header.Format.Font.Bold = true;
        header.Format.Alignment = ParagraphAlignment.Center;

        // Create main section for Sales Order
        //Paragraph main = section.AddParagraph();
        // main = section.AddParagraph();
        //main.Format.SpaceBefore = 1;

        // Create the item table for header
        //MigraDoc.DocumentObjectModel.Tables.Table tableTop = section.AddTable();
        MigraDoc.DocumentObjectModel.Tables.Table tableTop = section.Headers.Primary.AddTable();
        tableTop.Style               = "Table";
        tableTop.Borders.Color       = MigraDoc.DocumentObjectModel.Colors.Blue;
        tableTop.Borders.Width       = 0.25;
        tableTop.Borders.Left.Width  = 0.5;
        tableTop.Borders.Right.Width = 0.5;
        tableTop.Rows.LeftIndent     = 0;

        // Before you can add a row, you must define the columns
        Column columnTop = tableTop.AddColumn("8cm");

        columnTop.Format.Alignment = ParagraphAlignment.Left;
        columnTop = tableTop.AddColumn("3cm");
        columnTop.Format.Alignment = ParagraphAlignment.Left;
        columnTop = tableTop.AddColumn("7cm");
        columnTop.Format.Alignment = ParagraphAlignment.Left;

        Row rowTop = tableTop.AddRow();

        rowTop.Borders.Left.Visible   = false;
        rowTop.Borders.Right.Visible  = false;
        rowTop.Borders.Top.Visible    = false;
        rowTop.Borders.Bottom.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Borders.Left.Visible   = false;
        rowTop.Borders.Right.Visible  = false;
        rowTop.Borders.Top.Visible    = false;
        rowTop.Borders.Bottom.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Borders.Left.Visible   = false;
        rowTop.Borders.Right.Visible  = false;
        rowTop.Borders.Top.Visible    = false;
        rowTop.Borders.Bottom.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Borders.Left.Visible  = false;
        rowTop.Borders.Right.Visible = false;
        rowTop.Borders.Top.Visible   = false;
        //rowTop.Borders.Bottom.Visible = false;
        rowTop.Cells[0].AddParagraph();
        rowTop.Cells[0].Borders.Bottom.Visible = false;
        rowTop.Cells[1].AddParagraph();
        rowTop.Cells[2].AddParagraph();


        rowTop = tableTop.AddRow();
        rowTop.Cells[0].AddParagraph("Daripada:");
        rowTop.Cells[0].AddParagraph(modCompInfo.GetSetcomp_name);
        rowTop.Cells[0].AddParagraph(modCompInfo.GetSetcomp_address);
        rowTop.Cells[0].AddParagraph(modCompInfo.GetSetcomp_website);
        rowTop.Cells[0].Borders.Left.Visible   = false;
        rowTop.Cells[0].Borders.Right.Visible  = false;
        rowTop.Cells[0].Borders.Top.Visible    = false;
        rowTop.Cells[0].Borders.Bottom.Visible = false;
        rowTop.Cells[0].MergeDown = 5;
        rowTop.Cells[1].AddParagraph("No. Pesanan");
        rowTop.Cells[1].Borders.Right.Visible = false;
        rowTop.Cells[2].AddParagraph(": " + oModOrder.GetSetorderno);
        rowTop.Cells[2].Borders.Left.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[1].AddParagraph("Tarikh");
        rowTop.Cells[1].Borders.Right.Visible = false;
        rowTop.Cells[2].AddParagraph(": " + oModOrder.GetSetorderdate);
        rowTop.Cells[2].Borders.Left.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[1].AddParagraph("Jenis");
        rowTop.Cells[1].Borders.Right.Visible = false;
        rowTop.Cells[2].AddParagraph(": " + oModOrder.GetSetordertype);
        rowTop.Cells[2].Borders.Left.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[1].AddParagraph("Pejabat Agihan");
        rowTop.Cells[1].Borders.Right.Visible = false;
        rowTop.Cells[2].AddParagraph(": " + modCompInfo.GetSetcomp_name);
        rowTop.Cells[2].Borders.Left.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[1].AddParagraph("Pegawai Agihan");
        rowTop.Cells[1].Borders.Right.Visible = false;
        rowTop.Cells[2].AddParagraph(": " + oModOrder.GetSetusername);
        rowTop.Cells[2].Borders.Left.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[0].Borders.Bottom.Visible = false;
        rowTop.Cells[1].AddParagraph("No. Dihubungi");
        rowTop.Cells[1].Borders.Right.Visible = false;
        rowTop.Cells[2].AddParagraph(": " + modCompInfo.GetSetcomp_contactno);
        rowTop.Cells[2].Borders.Left.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[0].AddParagraph("");
        rowTop.Cells[0].MergeRight             = 2;
        rowTop.Cells[0].Borders.Left.Visible   = false;
        rowTop.Cells[0].Borders.Right.Visible  = false;
        rowTop.Cells[0].Borders.Top.Visible    = false;
        rowTop.Cells[0].Borders.Bottom.Visible = false;
        rowTop.Cells[2].Borders.Right.Visible  = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[0].AddParagraph("Kepada: ");
        rowTop.Cells[0].AddParagraph(oModOrder.GetSetbpdesc);
        rowTop.Cells[0].AddParagraph(oModOrder.GetSetbpaddress);
        rowTop.Cells[0].AddParagraph("Hubungi: " + oModOrder.GetSetbpcontact);
        rowTop.Cells[0].Borders.Left.Visible   = false;
        rowTop.Cells[0].Borders.Right.Visible  = false;
        rowTop.Cells[0].Borders.Bottom.Visible = false;
        rowTop.Cells[1].AddParagraph("Support: ");
        rowTop.Cells[1].AddParagraph(modCompInfo.GetSetcomp_contact);
        rowTop.Cells[1].AddParagraph("SALES & SUPPORT");
        rowTop.Cells[1].AddParagraph("Hubungi: " + modCompInfo.GetSetcomp_contactno);
        rowTop.Cells[1].Borders.Left.Visible   = false;
        rowTop.Cells[1].Borders.Right.Visible  = false;
        rowTop.Cells[1].Borders.Bottom.Visible = false;
        rowTop.Cells[1].MergeRight             = 1;
        rowTop.Cells[2].Borders.Right.Visible  = false;

        // Create the item table
        MigraDoc.DocumentObjectModel.Tables.Table table = section.AddTable();
        table.Style               = "Table";
        table.Borders.Color       = MigraDoc.DocumentObjectModel.Colors.Blue;
        table.Borders.Width       = 0.25;
        table.Borders.Left.Width  = 0.5;
        table.Borders.Right.Width = 0.5;
        table.Rows.LeftIndent     = 0;

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

        column.Format.Alignment = ParagraphAlignment.Center;

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

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

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

        column = table.AddColumn("2cm");
        column.Format.Alignment = ParagraphAlignment.Center;

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

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

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

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

        // 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    = MigraDoc.DocumentObjectModel.Colors.LightGray;
        row.Cells[0].AddParagraph("#");
        row.Cells[0].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[1].AddParagraph("NO. ITEM");
        row.Cells[1].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[1].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[2].AddParagraph("KETERANGAN");
        row.Cells[2].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[2].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[3].AddParagraph("HARGA UNIT");
        row.Cells[3].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[3].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[4].AddParagraph("DISKAUN");
        row.Cells[4].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[4].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[5].AddParagraph("QTY");
        row.Cells[5].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[5].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[6].AddParagraph("HARGA");
        row.Cells[6].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[6].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[7].AddParagraph("TAX");
        row.Cells[7].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[7].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[8].AddParagraph("JUMLAH");
        row.Cells[8].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[8].VerticalAlignment = VerticalAlignment.Bottom;

        for (int i = 0; i < lsOrderLineItem.Count; i++)
        {
            MainModel modOrdDet = (MainModel)lsOrderLineItem[i];

            // Each item fills two rows
            Row row1 = table.AddRow();
            row1.Height     = "2cm";
            row1.TopPadding = 1.5;
            //row1.Cells[0].VerticalAlignment = VerticalAlignment.Center;
            row1.Cells[0].Format.Alignment = ParagraphAlignment.Center;
            row1.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            row1.Cells[2].Format.Alignment = ParagraphAlignment.Left;
            row1.Cells[3].Format.Alignment = ParagraphAlignment.Right;
            row1.Cells[4].Format.Alignment = ParagraphAlignment.Right;
            row1.Cells[5].Format.Alignment = ParagraphAlignment.Center;
            row1.Cells[6].Format.Alignment = ParagraphAlignment.Right;
            row1.Cells[7].Format.Alignment = ParagraphAlignment.Right;
            row1.Cells[8].Format.Alignment = ParagraphAlignment.Right;

            row1.Cells[0].AddParagraph((i + 1).ToString());
            row1.Cells[1].AddParagraph(modOrdDet.GetSetitemno);
            row1.Cells[2].AddParagraph(modOrdDet.GetSetitemdesc);
            row1.Cells[3].AddParagraph(modOrdDet.GetSetunitprice.ToString("#,##0.00"));
            row1.Cells[4].AddParagraph(modOrdDet.GetSetdiscamount.ToString("#,##0.00"));
            row1.Cells[5].AddParagraph(modOrdDet.GetSetquantity.ToString());
            row1.Cells[6].AddParagraph(modOrdDet.GetSetorderprice.ToString("#,##0.00"));
            row1.Cells[7].AddParagraph(modOrdDet.GetSettaxamount.ToString("#,##0.00"));
            row1.Cells[8].AddParagraph(modOrdDet.GetSettotalprice.ToString("#,##0.00"));

            if (i > 0 && ((i + 1) % 6) == 0)
            {
                row1.Cells[0].Borders.Bottom.Visible = true;
                row1.Cells[1].Borders.Bottom.Visible = true;
                row1.Cells[2].Borders.Bottom.Visible = true;
                row1.Cells[3].Borders.Bottom.Visible = true;
                row1.Cells[4].Borders.Bottom.Visible = true;
                row1.Cells[5].Borders.Bottom.Visible = true;
                row1.Cells[6].Borders.Bottom.Visible = true;
                row1.Cells[7].Borders.Bottom.Visible = true;
                row1.Cells[8].Borders.Bottom.Visible = true;
            }
            else
            {
                row1.Cells[0].Borders.Bottom.Visible = false;
                row1.Cells[1].Borders.Bottom.Visible = false;
                row1.Cells[2].Borders.Bottom.Visible = false;
                row1.Cells[3].Borders.Bottom.Visible = false;
                row1.Cells[4].Borders.Bottom.Visible = false;
                row1.Cells[5].Borders.Bottom.Visible = false;
                row1.Cells[6].Borders.Bottom.Visible = false;
                row1.Cells[7].Borders.Bottom.Visible = false;
                row1.Cells[8].Borders.Bottom.Visible = false;
            }
        }
        if ((lsOrderLineItem.Count % 6) > 0)
        {
            int totalremainingrow = 6 - (lsOrderLineItem.Count % 6);
            for (int j = 0; j < totalremainingrow; j++)
            {
                Row rowRemain = table.AddRow();
                rowRemain.Height = "2cm";
                rowRemain.Cells[0].AddParagraph();
                rowRemain.Cells[1].AddParagraph();
                rowRemain.Cells[2].AddParagraph();
                rowRemain.Cells[3].AddParagraph();
                rowRemain.Cells[4].AddParagraph();
                rowRemain.Cells[5].AddParagraph();
                rowRemain.Cells[6].AddParagraph();
                rowRemain.Cells[7].AddParagraph();
                rowRemain.Cells[8].AddParagraph();

                if (j == (totalremainingrow - 1))
                {
                    rowRemain.Cells[0].Borders.Bottom.Visible = true;
                    rowRemain.Cells[1].Borders.Bottom.Visible = true;
                    rowRemain.Cells[2].Borders.Bottom.Visible = true;
                    rowRemain.Cells[3].Borders.Bottom.Visible = true;
                    rowRemain.Cells[4].Borders.Bottom.Visible = true;
                    rowRemain.Cells[5].Borders.Bottom.Visible = true;
                    rowRemain.Cells[6].Borders.Bottom.Visible = true;
                    rowRemain.Cells[7].Borders.Bottom.Visible = true;
                    rowRemain.Cells[8].Borders.Bottom.Visible = true;
                }
                else if (j > 0 && (j % (totalremainingrow - 1)) == 0)
                {
                    rowRemain.Cells[0].Borders.Bottom.Visible = true;
                    rowRemain.Cells[1].Borders.Bottom.Visible = true;
                    rowRemain.Cells[2].Borders.Bottom.Visible = true;
                    rowRemain.Cells[3].Borders.Bottom.Visible = true;
                    rowRemain.Cells[4].Borders.Bottom.Visible = true;
                    rowRemain.Cells[5].Borders.Bottom.Visible = true;
                    rowRemain.Cells[6].Borders.Bottom.Visible = true;
                    rowRemain.Cells[7].Borders.Bottom.Visible = true;
                    rowRemain.Cells[8].Borders.Bottom.Visible = true;
                }
                else
                {
                    rowRemain.Cells[0].Borders.Bottom.Visible = false;
                    rowRemain.Cells[1].Borders.Bottom.Visible = false;
                    rowRemain.Cells[2].Borders.Bottom.Visible = false;
                    rowRemain.Cells[3].Borders.Bottom.Visible = false;
                    rowRemain.Cells[4].Borders.Bottom.Visible = false;
                    rowRemain.Cells[5].Borders.Bottom.Visible = false;
                    rowRemain.Cells[6].Borders.Bottom.Visible = false;
                    rowRemain.Cells[7].Borders.Bottom.Visible = false;
                    rowRemain.Cells[8].Borders.Bottom.Visible = false;
                }
            }
        }

        /*
         * Row rowTax = table.AddRow();
         * //rowTax.Height = "1cm";
         * rowTax.Cells[0].AddParagraph();
         * rowTax.Cells[0].Borders.Left.Visible = false;
         * rowTax.Cells[0].Borders.Right.Visible = false;
         * rowTax.Cells[0].Borders.Bottom.Visible = false;
         * rowTax.Cells[0].MergeRight = 6;
         * rowTax.Cells[7].AddParagraph("TAX");
         * rowTax.Cells[7].Format.Alignment = ParagraphAlignment.Left;
         * rowTax.Cells[8].AddParagraph(oModOrder.GetSettaxamount.ToString("#,##0.00"));
         * rowTax.Cells[8].Format.Alignment = ParagraphAlignment.Right;
         */

        Row rowTot = table.AddRow();

        rowTot.Height           = "1cm";
        rowTot.Format.Font.Bold = true;
        rowTot.Cells[0].AddParagraph();
        rowTot.Cells[0].Borders.Left.Visible   = false;
        rowTot.Cells[0].Borders.Right.Visible  = false;
        rowTot.Cells[0].Borders.Bottom.Visible = false;
        rowTot.Cells[0].MergeRight             = 6;

        /*
         * rowTot.Cells[1].AddParagraph();
         * rowTot.Cells[1].Borders.Left.Visible = false;
         * rowTot.Cells[2].AddParagraph();
         * rowTot.Cells[2].Borders.Left.Visible = false;
         * rowTot.Cells[3].AddParagraph();
         * rowTot.Cells[3].Borders.Left.Visible = false;
         * rowTot.Cells[4].AddParagraph();
         * rowTot.Cells[4].Borders.Left.Visible = false;
         * rowTot.Cells[5].AddParagraph();
         * rowTot.Cells[5].Borders.Left.Visible = false;
         * rowTot.Cells[6].AddParagraph();
         * rowTot.Cells[6].Borders.Left.Visible = false;
         */
        rowTot.Cells[6].Borders.Right.Visible = false;

        rowTot.Cells[7].AddParagraph("JUMLAH BESAR");
        rowTot.Cells[7].Format.Alignment     = ParagraphAlignment.Left;
        rowTot.Cells[7].VerticalAlignment    = VerticalAlignment.Center;
        rowTot.Cells[7].Borders.Left.Visible = false;
        //rowTot.Cells[7].Borders.Right.Visible = false;
        rowTot.Cells[7].Borders.Bottom.Visible = false;

        rowTot.Cells[8].AddParagraph(oModOrder.GetSettotalamount.ToString("#,##0.00"));
        rowTot.Cells[8].Format.Alignment  = ParagraphAlignment.Right;
        rowTot.Cells[8].VerticalAlignment = VerticalAlignment.Center;

        //footer.AddText("Footer");
        //footer.Format.Font.Size = 9;
        //footer.Format.Alignment = ParagraphAlignment.Center;

        // Create the item table for footer
        //MigraDoc.DocumentObjectModel.Tables.Table tblBtm = section.Headers.Primary.AddImage(logo_lima);
        MigraDoc.DocumentObjectModel.Tables.Table tblBtm = section.Footers.Primary.AddTable();
        //MigraDoc.DocumentObjectModel.Tables.Table tblBtm = section.AddTable();
        tblBtm.Style               = "Table";
        tblBtm.Borders.Color       = MigraDoc.DocumentObjectModel.Colors.Blue;
        tblBtm.Borders.Width       = 0.25;
        tblBtm.Borders.Left.Width  = 0.5;
        tblBtm.Borders.Right.Width = 0.5;
        tblBtm.Rows.LeftIndent     = 0;

        // Before you can add a row, you must define the columns
        Column colTblBtm = tblBtm.AddColumn("6cm");

        colTblBtm.Format.Alignment = ParagraphAlignment.Left;
        colTblBtm = tblBtm.AddColumn("6cm");
        colTblBtm.Format.Alignment = ParagraphAlignment.Left;
        colTblBtm = tblBtm.AddColumn("6cm");
        colTblBtm.Format.Alignment = ParagraphAlignment.Left;

        Row rowTblBtm = tblBtm.AddRow();

        rowTblBtm.Borders.Left.Visible  = false;
        rowTblBtm.Borders.Right.Visible = false;
        rowTblBtm.Borders.Top.Visible   = false;
        //rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph("Catatan:");
        rowTblBtm.Cells[0].MergeRight = 2;

        rowTblBtm = tblBtm.AddRow();
        //rowTblBtm.Borders.Left.Visible = false;
        //rowTblBtm.Borders.Right.Visible = false;
        //rowTblBtm.Borders.Top.Visible = false;
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph(oModOrder.GetSetorderremarks);
        rowTblBtm.Cells[0].MergeRight = 2;

        rowTblBtm        = tblBtm.AddRow();
        rowTblBtm.Height = "2cm";
        //rowTblBtm.Borders.Left.Visible = false;
        //rowTblBtm.Borders.Right.Visible = false;
        rowTblBtm.Borders.Top.Visible = false;
        //rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph();
        rowTblBtm.Cells[0].MergeRight = 2;

        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Left.Visible   = false;
        rowTblBtm.Borders.Right.Visible  = false;
        rowTblBtm.Borders.Top.Visible    = false;
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph("1. Setelah Pesanan Agihan disahkan, sebarang pembatalan dan perubahan pesanan tidak dibenarkan.");
        rowTblBtm.Cells[0].MergeRight = 2;

        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Left.Visible   = false;
        rowTblBtm.Borders.Right.Visible  = false;
        rowTblBtm.Borders.Top.Visible    = false;
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph("2. Penghantaran item Pesanan Agihan akan dilakukan setelah menerima pengesahan daripada Pejabat Agihan.");
        rowTblBtm.Cells[0].MergeRight = 2;

        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Left.Visible   = false;
        rowTblBtm.Borders.Right.Visible  = false;
        rowTblBtm.Borders.Top.Visible    = false;
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph("3. Perubahan pada harga item Pesanan Agihan adalah tertakluk kepada terma & syarat tanpa sebarang notis.");
        rowTblBtm.Cells[0].MergeRight = 2;

        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Left.Visible  = false;
        rowTblBtm.Borders.Right.Visible = false;
        rowTblBtm.Borders.Top.Visible   = false;
        //rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph();
        rowTblBtm.Cells[0].MergeRight = 1;
        rowTblBtm.Cells[2].AddParagraph();
        rowTblBtm.Cells[2].Borders.Bottom.Visible = false;

        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Format.Font.Bold = true;
        rowTblBtm.Cells[0].AddParagraph(oModOrder.GetSetbpdesc);
        //rowTblBtm.Cells[0].Borders.Top.Visible = true;
        rowTblBtm.Cells[1].AddParagraph(modCompInfo.GetSetcomp_name);
        rowTblBtm.Cells[2].AddParagraph();
        rowTblBtm.Cells[2].Borders.Left.Visible   = false;
        rowTblBtm.Cells[2].Borders.Right.Visible  = false;
        rowTblBtm.Cells[2].Borders.Top.Visible    = false;
        rowTblBtm.Cells[2].Borders.Bottom.Visible = false;
        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph("Disahkan Oleh: (Cop dan Tandatangan)");
        rowTblBtm.Cells[1].AddParagraph("Disemak Oleh:");
        rowTblBtm.Cells[2].AddParagraph();
        rowTblBtm.Cells[2].Borders.Left.Visible   = false;
        rowTblBtm.Cells[2].Borders.Right.Visible  = false;
        rowTblBtm.Cells[2].Borders.Top.Visible    = false;
        rowTblBtm.Cells[2].Borders.Bottom.Visible = false;
        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Bottom.Visible          = false;
        rowTblBtm.Cells[2].Borders.Left.Visible   = false;
        rowTblBtm.Cells[2].Borders.Right.Visible  = false;
        rowTblBtm.Cells[2].Borders.Top.Visible    = false;
        rowTblBtm.Cells[2].Borders.Bottom.Visible = false;
        rowTblBtm.Height = "2cm";
        rowTblBtm        = tblBtm.AddRow();
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph("Nama:");
        rowTblBtm.Cells[1].AddParagraph("Nama:");
        rowTblBtm.Cells[2].AddParagraph();
        rowTblBtm.Cells[2].Borders.Left.Visible   = false;
        rowTblBtm.Cells[2].Borders.Right.Visible  = false;
        rowTblBtm.Cells[2].Borders.Top.Visible    = false;
        rowTblBtm.Cells[2].Borders.Bottom.Visible = false;
        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph("Jawatan:");
        rowTblBtm.Cells[1].AddParagraph("Jawatan: Pegawai Agihan & Pemasaran");
        rowTblBtm.Cells[2].AddParagraph();
        rowTblBtm.Cells[2].Borders.Left.Visible   = false;
        rowTblBtm.Cells[2].Borders.Right.Visible  = false;
        rowTblBtm.Cells[2].Borders.Top.Visible    = false;
        rowTblBtm.Cells[2].Borders.Bottom.Visible = false;
        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Cells[0].AddParagraph("Tarikh:");
        rowTblBtm.Cells[1].AddParagraph("Tarikh:");
        rowTblBtm.Cells[2].AddParagraph();
        rowTblBtm.Cells[2].Borders.Left.Visible   = false;
        rowTblBtm.Cells[2].Borders.Right.Visible  = false;
        rowTblBtm.Cells[2].Borders.Top.Visible    = false;
        rowTblBtm.Cells[2].Borders.Bottom.Visible = false;

        // Create a renderer for PDF that uses Unicode font encoding
        PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true);

        // Set the MigraDoc document
        pdfRenderer.Document = doc;

        // Create the PDF document
        pdfRenderer.RenderDocument();

        // Save the document...
        string pdfFilename = sOrderNo + ".pdf";
        string file        = Server.MapPath("~/App_Data/" + pdfFilename);
        //string file = HttpContext.Current.Server.MapPath("~/pdf/" + pdfFilename);
        //string file = "C:/TEMP/" + pdfFilename;

        // ...and start a viewer //
        //pdfRenderer.Save(file);
        //Process.Start(file);

        // Send PDF to browser //
        MemoryStream stream = new MemoryStream();

        pdfRenderer.Save(stream, false);
        Response.Clear();
        Response.ContentType = "application/pdf";
        Response.AddHeader("content-length", stream.Length.ToString());
        Response.BinaryWrite(stream.ToArray());
        Response.Flush();
        stream.Close();
        Response.End();

        //download file //
        //Response.ContentType = "Application/pdf";
        //Response.AppendHeader("Content-Disposition", "attachment; filename=" + pdfFilename);
        //Response.TransmitFile(file);
        //Response.End();
    }
Beispiel #11
0
        private static void AddSection(Document document, InfoClinic InformationOfClinic, string MaBn, Patient patient, List<Medicine> Medicines, bool onlyServices, string taikham, ref int tongTienThuoc, string Diagno, string tuoi, int Stt, string reasonComeBack)
        {
            Section section = document.AddSection();
            section.PageSetup.LeftMargin = 10;

            Paragraph paragraph =section.Headers.Primary.AddParagraph();
             //= section.AddParagraph();

            paragraph.Format.Alignment = ParagraphAlignment.Left;

            paragraph.AddText(InformationOfClinic.Name); //+"Mã BN: " + patient.Id + " \n" +" Địa chỉ xxxxx");
            paragraph.AddText(" \n");

            string[] addressArray = InformationOfClinic.Address.Split(';');

            paragraph.AddSpace(int.Parse(addressArray[0]));
            paragraph.AddText(addressArray[1]);
            paragraph.AddText(" \n");

            string[] sdtArray = InformationOfClinic.Sdt.Split(';');
            paragraph.AddSpace(int.Parse(sdtArray[0]));
            paragraph.AddText(sdtArray[1]);

            Paragraph paragraph2 = section.Headers.Primary.AddParagraph();

            paragraph2.Format.Alignment = ParagraphAlignment.Right;
            paragraph2.AddText("ID : " + MaBn);
            paragraph2.AddText(" \n");
            paragraph2.AddText("STT : " + Stt);

            paragraph.AddText(" \n");
            paragraph.AddText(" \n");
            paragraph.AddText(" \n");
            paragraph.AddText(" \n");
            //Table InfoTable = section.AddTable();
            //InfoTable.Borders.Width = 0;
            //Column ColumnInfo1 = InfoTable.AddColumn(500);
            //Row rowInfoName = InfoTable.AddRow();
            //Paragraph para1 = rowInfoName.Cells[0].AddParagraph(InformationOfClinic.Name);
            //Row rowInfo2 = InfoTable.AddRow();

            //Paragraph paraInfo = rowInfo2.Cells[0].AddParagraph();
            //paraInfo.AddSpace(4);
            //paraInfo.AddText(InformationOfClinic.Address);
            //rowsignatureAndMore2.Cells[0].AddParagraph(taikham);
            //Paragraph para = rowsignatureAndMore2.Cells[2].AddParagraph(" \n \n \n \n" + Form1.nameOfDoctor);
            //para.Format.Alignment = ParagraphAlignment.Center;

            Paragraph paragraphTitle = section.AddParagraph();
            paragraphTitle.Format.Alignment = ParagraphAlignment.Center;
            paragraphTitle.AddTab();
            paragraphTitle.AddTab();
            if (!onlyServices)
            {

                paragraphTitle.AddFormattedText("TOA THUỐC \n \n", new MigraDoc.DocumentObjectModel.Font("Times New Roman", 24));
            }
            else
            {
                paragraphTitle.AddFormattedText("Bảng Dịch Vụ \n \n", new MigraDoc.DocumentObjectModel.Font("Times New Roman", 24));
            }

            Table table = new Table();
            table.Borders.Width = 0;
            Column column = table.AddColumn();
            column.Width = 80;
            table.AddColumn(440);

            Row row = table.AddRow();
            row.Cells[0].AddParagraph("Bệnh nhân: ");
            row.Cells[1].AddParagraph(patient.Name);
            //int tuoi = DateTime.Now.Year - patient.Birthday.Year;
            row.Cells[0].AddParagraph("Tuổi:");
            row.Cells[1].AddParagraph(tuoi);
            Row row2 = table.AddRow();
            row2.Cells[0].AddParagraph("Địa chỉ: ");
            row2.Cells[1].AddParagraph(patient.Address);
            //row2.Cells[2].AddParagraph("Mã BN: "+ patient.Id);
            if (!onlyServices)
            {
                Row row3 = table.AddRow();
                row3.Cells[0].AddParagraph("Chẩn đoán: ");
                row3.Cells[1].AddParagraph(Diagno);
            }

            Table tableMedicines = new Table();
            tableMedicines.Borders.Width = 0;
            tableMedicines.BottomPadding = 10;
            Column columnMedicines1 = tableMedicines.AddColumn(30);
            Column columnMedicines2;
            if (onlyServices)
            {
               columnMedicines2 = tableMedicines.AddColumn(140);
            }
            else
            {
                 columnMedicines2 = tableMedicines.AddColumn(240);
            }
            Column columnMedicines3 = tableMedicines.AddColumn(70);
            Column columnMedicines4 = tableMedicines.AddColumn(130);
            Row rowMedicinesHeader = tableMedicines.AddRow();
            rowMedicinesHeader.Cells[0].AddParagraph("STT");
            if (!onlyServices)
            {
                rowMedicinesHeader.Cells[1].AddParagraph("Tên thuốc/Cách dùng");
            }
            else
            {
                rowMedicinesHeader.Cells[1].AddParagraph("Tên dịch vụ");
            }
            rowMedicinesHeader.Cells[2].AddParagraph("Số lượng");

            if (onlyServices)
            {
                rowMedicinesHeader.Cells[3].AddParagraph("Số tiền");
                int totalServices = 0;
                int indexServices = 1;
                for (int i = 0; i < Medicines.Count; i++)
                {
                    if (Medicines[i].Name[0] == '@')
                    {
                        string name = Medicines[i].Name.Substring(1, Medicines[i].Name.Length - 1);
                        Row rowDetail = tableMedicines.AddRow();
                        rowDetail.Cells[0].AddParagraph(indexServices.ToString());
                        rowDetail.Cells[1].AddParagraph(name + "\n" + Medicines[i].HDSD);
                        rowDetail.Cells[2].AddParagraph(Medicines[i].Number.ToString());
                        rowDetail.Cells[3].AddParagraph(Medicines[i].CostOut.ToString("C0"));
                        indexServices++;

                        totalServices += Medicines[i].CostOut;
                    }

                }
                //tong cong thuoc

                Row rowTotalThuoc = tableMedicines.AddRow();
                rowTotalThuoc.Cells[1].AddParagraph("Thuốc");
                rowTotalThuoc.Cells[3].AddParagraph(tongTienThuoc.ToString("C0"));

                Row gachdit = tableMedicines.AddRow();
                gachdit.Cells[3].AddParagraph("________________");

                int total = totalServices + tongTienThuoc;

                Row rowTotal = tableMedicines.AddRow();
                rowTotal.Cells[2].AddParagraph("Tổng cộng:");
                rowTotal.Cells[3].AddParagraph(total.ToString("C0"));
            }
            else
            {
                int indexMedicines = 1;
                for (int i = 0; i < Medicines.Count; i++)
                {
                    if (Medicines[i].Name[0] != '@')
                    {
                        Row rowDetail = tableMedicines.AddRow();
                        rowDetail.Cells[0].AddParagraph(indexMedicines.ToString());
                        rowDetail.Cells[1].AddParagraph(Medicines[i].Name + "\n" + Medicines[i].HDSD);
                        rowDetail.Cells[2].AddParagraph(Medicines[i].Number.ToString());
                        indexMedicines++;
                        tongTienThuoc += Medicines[i].CostOut;
                    }
                }
            }

            //Table loi dan , chu ky
            Table signatureAndMore = new Table();
            signatureAndMore.Borders.Width = 0;
            Column columnsignatureAndMore1 = signatureAndMore.AddColumn(150);
            Column columnsignatureAndMore2 = signatureAndMore.AddColumn(50);
            Column columnsignatureAndMore3 = signatureAndMore.AddColumn(210);
            Row rowsignatureAndMore1 = signatureAndMore.AddRow();

            if (!onlyServices)
            {
               // rowsignatureAndMore1.Cells[0].AddParagraph("Lời dặn: " + InformationOfClinic.Advice);
            }
            Paragraph paramNgayThang = rowsignatureAndMore1.Cells[2].AddParagraph("Ngày " + DateTime.Now.Day + " tháng " + DateTime.Now.Month + " năm " + DateTime.Now.Year);
            paramNgayThang.Format.Alignment = ParagraphAlignment.Center;
            Row rowsignatureAndMore2 = signatureAndMore.AddRow();
            rowsignatureAndMore2.VerticalAlignment = VerticalAlignment.Center;
            rowsignatureAndMore2.Cells[0].AddParagraph(taikham + ": " + reasonComeBack);
            Paragraph para = rowsignatureAndMore2.Cells[2].AddParagraph(" \n \n \n \n" + Form1.nameOfDoctor);
            para.Format.Alignment = ParagraphAlignment.Center;

            document.LastSection.Add(table);
            document.LastSection.AddParagraph("\n");
            document.LastSection.Add(tableMedicines);
            document.LastSection.AddParagraph("\n");
            document.LastSection.Footers.Primary.Add(signatureAndMore);
        }
        private void createJobDetailsSection()
        {
            Section currentSection = (Section)serviceSheetDoc.Sections.LastObject;
            jobDetailsTable = currentSection.AddTable();

            //Setup the table columns and borders
            Column tableColumnn = jobDetailsTable.AddColumn(COLUMN_ONE_WIDTH);
            tableColumnn = jobDetailsTable.AddColumn(COLUMN_TWO_WIDTH);
            jobDetailsTable.Borders.Color = tableBorderColour;
            jobDetailsTable.Borders.Width = borderWidth;

            Row row1Title = jobDetailsTable.AddRow();
            row1Title.Cells[0].MergeRight = 1;
            Paragraph jobDetailsPara = row1Title.Cells[0].AddParagraph();
            jobDetailsPara.AddFormattedText("J", "allCapsFirstLetter");
            jobDetailsPara.AddFormattedText("OB ", "allCapsNextLetter");
            jobDetailsPara.AddFormattedText("D", "allCapsFirstLetter");
            jobDetailsPara.AddFormattedText("ETAILS ", "allCapsNextLetter");
            row1Title.Cells[0].Shading.Color = headerGrey;

            addLineToJobDetails("Customer", currentSheet.Customer);
            addLineToJobDetails("Address Line 1", currentSheet.AddressLine1);
            addLineToJobDetails("Address Line 2", currentSheet.AddressLine2);
            addLineToJobDetails("Town/City", currentSheet.TownCity);
            addLineToJobDetails("Postcode", currentSheet.Postcode);
            addLineToJobDetails("Customer contact", currentSheet.CustomerContact);
            addLineToJobDetails("Customer phone number", currentSheet.CustomerPhoneNo);
            addLineToJobDetails("Machine make and model", currentSheet.MachineMakeModel);
            addLineToJobDetails("Machine serial number", currentSheet.MachineSerial);
            addLineToJobDetails("CNC controller", currentSheet.CncControl);
            addLineToJobDetails("Job start date", currentSheet.DtJobStart.ToShortDateString());
            addLineToJobDetails("Customer order no.", currentSheet.CustomerOrderNo);
            addLineToJobDetails("MTT job no.", currentSheet.MttJobNumber);
            addLineToJobDetails("Job description", currentSheet.JobDescription);

            //Add a line break between the tables
            currentSection.AddParagraph();
           
        }
        private void createServiceReportSection()
        { 
            Section currentSection = (Section)serviceSheetDoc.Sections.LastObject;
            serviceReportTable = currentSection.AddTable();

            //Setup the table columns and borders
            Column tableColumnn = serviceReportTable.AddColumn(COLUMN_ONE_WIDTH);
            tableColumnn = serviceReportTable.AddColumn(COLUMN_TWO_WIDTH);
            serviceReportTable.Borders.Color = tableBorderColour;
            serviceReportTable.Borders.Width = borderWidth;

            Row row1Title = serviceReportTable.AddRow();
            row1Title.Cells[0].MergeRight = 1;
            Paragraph serviceReportPara = row1Title.Cells[0].AddParagraph();
            serviceReportPara.AddFormattedText("S", "allCapsFirstLetter");
            serviceReportPara.AddFormattedText("ERVICE ", "allCapsNextLetter");
            serviceReportPara.AddFormattedText("R", "allCapsFirstLetter");
            serviceReportPara.AddFormattedText("EPORT", "allCapsNextLetter");
            row1Title.Cells[0].Shading.Color = headerGrey;

            row1Title.KeepWith = 8;

            addLineToServiceReportTable("Total travel time", currentSheet.JobTotalTravelTime.ToString());
            addLineToServiceReportTable("Total time onsite", currentSheet.JobTotalTimeOnsite.ToString());
            addLineToServiceReportTable("Total mileage", currentSheet.JobTotalMileage.ToString());
            addLineToServiceReportTable("Total daily allowances", currentSheet.TotalDailyAllowances.ToString());
            addLineToServiceReportTable("Total overnight allowances", currentSheet.TotalOvernightAllowances.ToString());
            //RT - If there are no barier payments, then don't include the total
            double totalBarrierPayments = currentSheet.TotalBarrierPayments;
            if (totalBarrierPayments > 0)
            {
                addLineToServiceReportTable("Total barrier payments", currentSheet.TotalBarrierPayments.ToString());
            }
            else
            {
                //Decrease the keepwith by 1 as we are removing a row
                row1Title.KeepWith = 7;
            }
            addLineToServiceReportTable("Job status", currentSheet.JobStatus);
            addLineToServiceReportTable("Job report", currentSheet.FinalJobReport);

            //Add a space before the next table
            currentSection.AddParagraph();
        }
Beispiel #14
0
        /// <summary>
        /// Renders a single paragraph.
        /// </summary>
        void GenerateReport(PdfDocument document)
        {
            //PdfPage page = document.AddPage();
            PdfPage page = document.Pages[0];

            XGraphics gfx = XGraphics.FromPdfPage(page);

            // HACK²
            gfx.MUH  = PdfFontEncoding.Unicode;
            gfx.MFEH = PdfFontEmbedding.Default;

            XFont font = new XFont("Verdana", 4, XFontStyle.Regular);



            // map image origin
            //gfx.DrawString("O", font, XBrushes.Red, new XRect(5, 5, 108, 161), XStringFormats.Center);


            // ovmap image origin
            //gfx.DrawString("X", font, XBrushes.Red, new XRect(5, 5, 798, 1144), XStringFormats.Center);



            //gfx.DrawString("+", font, XBrushes.Red, new XRect(5, 5, 100, 1299), XStringFormats.Center);



            //XImage ximg = XImage.FromFile(mapImagePth);
            XImage ximg = XImage.FromGdiPlusImage(mimg);

            //ximg.Interpolate = true;
            Point ipt = new Point(58, 86);

            //gfx.SmoothingMode = XSmoothingMode.HighQuality;
            gfx.DrawImage(ximg, ipt);



            //gfx.DrawImage(ximg, ipt.X, ipt.Y, ApplyTransform(ximg.PointWidth), ApplyTransform(ximg.PointHeight));


            /*
             * XImage ximg_ov = XImage.FromFile(ovmapImagePth);
             * Point ov_ipt = new Point(398, 580);
             * gfx.DrawImage(ximg_ov, ov_ipt);
             */

            //String ovmapImageTPth = @"C:\inetpub\wwwroot\ms6\output\ov\ov13_mxd_a.png";

            /*
             * XImage ximg_ov = XImage.FromFile(ovmapImagePth);
             *
             * Point ov_ipt = new Point(408, 570);
             * //gfx.DrawImage(ximg_ov, ov_ipt);
             * gfx.DrawImage(ximg_ov, ov_ipt.X, ov_ipt.Y,97,130);
             */
            /*
             * double rminx = 1218342.661;
             * double rminy = 500202.9879;
             * double rmaxx = 1397365.953;
             * double rmaxy = 738900.7105;
             * double rxw = 179023.292;
             * double rxh = 238697.7226;
             * double img_width = 97.0;
             * double img_height = 130.0;
             */
            double rminx      = 1232659.28962;
            double rminy      = 498047.976697;
            double rmaxx      = 1390211.37295;
            double rmaxy      = 739801.448919;
            double rxw        = 157552.0833;
            double rxh        = 241753.4722;
            double img_width  = 87;
            double img_height = 133;
            double qx         = minx + ((maxx - minx) / 2.0);
            double qy         = miny + ((maxy - miny) / 2.0);

            double pct_x = (qx - rminx) / rxw;
            double pct_y = (qy - rminy) / rxh;

            double px_x = pct_x * img_width;
            double px_y = (1.0 - pct_y) * img_height;

            double ul_px = ((minx - rminx) / rxw) * img_width;
            double ul_py = (1.0 - ((maxy - rminy) / rxh)) * img_height;

            double qwidth_pct = (maxx - minx) / (rmaxx - rminx);
            double qhght_pct  = (maxy - miny) / (rmaxy - rminy);

            double px_width = qwidth_pct * img_width;
            double px_hgt   = qhght_pct * img_height;


            //Debug.Print(String.Format("qx/qy: {0}  {1}    pct_x/pct_y: {2}  {3}   px_x/px_y:  {4}  {5} ", qx, qy, pct_x, pct_y, px_x, px_y));



            // option #1 - using graphics object directly on image
            Image ovImg = Image.FromFile(ovmapImageTPth);

            using (Graphics g = Graphics.FromImage(ovImg))
            {
                Pen myPen = new Pen(System.Drawing.Color.Red, 5);
                System.Drawing.Font myFont = new System.Drawing.Font("Helvetica", 15, FontStyle.Bold);
                Brush myBrush = new SolidBrush(System.Drawing.Color.Red);
                g.DrawString("x", myFont, myBrush, new PointF((float)px_x, (float)px_y));
                g.DrawRectangle(myPen, (float)ul_px, (float)ul_py, (float)px_width, (float)px_hgt);
            }

            ovImg.Save(ovmapImagePth);
            XImage ximg_ov = XImage.FromFile(ovmapImagePth);



            XImage ximgn = XImage.FromFile(northimgpth);

            //ximg.Interpolate = true;
            Point iptn = new Point(520, 570);

            //gfx.SmoothingMode = XSmoothingMode.HighQuality;
            gfx.DrawImage(ximgn, iptn);



            Point ov_ipt = new Point(400, 570);
            //gfx.DrawImage(ximg_ov, ov_ipt);

            //gfx.DrawImage(ximg_ov, ov_ipt.X, ov_ipt.Y, 97, 130);

            RectangleF srcR  = new RectangleF(0, 0, (int)img_width, (int)img_height);
            RectangleF destR = new RectangleF(ov_ipt.X, ov_ipt.Y, (int)img_width, (int)img_height);

            gfx.DrawImage(ximg_ov, destR, srcR, XGraphicsUnit.Point);

            // option #2 - using pdf object directly on report



            // XPen peno = new XPen(XColors.Aqua, 0.5);

            //gfx.DrawRectangle(peno, 408, 570,  95,  128);

            //peno = new XPen(XColors.DodgerBlue, 0.5);

            //gfx.DrawRectangle(peno, 354, 570, 200, 128);



            XPen pen = new XPen(XColors.Black, 0.5);

            gfx.DrawRectangle(pen, 29, 59, 555, 643);


            XPen pen2 = new XPen(XColors.Black, 0.8);

            gfx.DrawRectangle(pen, 29, 566, 555, 136);


            XPen   pen3  = new XPen(XColors.HotPink, 0.5);
            XBrush brush = XBrushes.LightPink;

            gfx.DrawRectangle(pen, brush, 29, 705, 555, 43);



            Document doc = new Document();



            // You always need a MigraDoc document for rendering.

            Section sec = doc.AddSection();
            // Add a single paragraph with some text and format information.
            Paragraph para = sec.AddParagraph();

            para.Format.Alignment  = ParagraphAlignment.Justify;
            para.Format.Font.Name  = "Verdana";
            para.Format.Font.Size  = Unit.FromPoint(6);
            para.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.DarkGray;
            para.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.DarkGray;
            //para.AddText("Duisism odigna acipsum delesenisl ");
            //para.AddFormattedText("ullum in velenit", TextFormat.Bold);

            para.AddText("Okaloosa County makes every effort to produce the most accurate information possible. No warranties, expressed or implied, are provided for the data herein, its use or interpretation. The assessment information is from the last certified taxroll. All data is subject to change before the next certified taxroll. PLEASE NOTE THAT THE GIS MAPS ARE FOR ASSESSMENT PURPOSES ONLY NEITHER OKALOOSA COUNTY NOR ITS EMPLOYEES ASSUME RESPONSIBILITY FOR ERRORS OR OMISSIONS ---THIS IS NOT A SURVEY---");


            //para.Format.Borders.Distance = "1pt";
            //para.Format.Borders.Color = Colors.Orange;

            // Create a renderer and prepare (=layout) the document
            MigraDoc.Rendering.DocumentRenderer docRenderer = new DocumentRenderer(doc);
            docRenderer.PrepareDocument();

            // Render the paragraph. You can render tables or shapes the same way.  29, 705, 555, 43
            docRenderer.RenderObject(gfx, XUnit.FromPoint(38), XUnit.FromPoint(710), XUnit.FromPoint(535), para);



            Section section = doc.AddSection();



            MigraDoc.DocumentObjectModel.Tables.Table table = section.AddTable();
            table.Style         = "Table";
            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     = 0;
            table.Format.Font.Name    = "Verdana";
            table.Format.Font.Size    = Unit.FromPoint(6);
            table.Rows.Height         = Unit.FromInch(0.203);

            /*
             * // Before you can add a row, you must define the columns
             * Column column = table.AddColumn("1cm");
             * column.Format.Alignment = ParagraphAlignment.Center;
             *
             * column = table.AddColumn("2.5cm");
             * column.Format.Alignment = ParagraphAlignment.Right;
             *
             * column = table.AddColumn("3cm");
             * column.Format.Alignment = ParagraphAlignment.Right;
             *
             * column = table.AddColumn("3.5cm");
             * column.Format.Alignment = ParagraphAlignment.Right;
             *
             * column = table.AddColumn("2cm");
             * column.Format.Alignment = ParagraphAlignment.Center;
             *
             * column = table.AddColumn("4cm");
             * column.Format.Alignment = ParagraphAlignment.Right;
             *
             * // 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 = MigraDoc.DocumentObjectModel.Colors.Blue;
             * row.Cells[0].AddParagraph("Item");
             * row.Cells[0].Format.Font.Bold = false;
             * row.Cells[0].Format.Alignment = ParagraphAlignment.Left;
             * row.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
             * row.Cells[0].MergeDown = 1;
             * row.Cells[1].AddParagraph("Title and Author");
             * row.Cells[1].Format.Alignment = ParagraphAlignment.Left;
             * row.Cells[1].MergeRight = 3;
             * row.Cells[5].AddParagraph("Extended Price");
             * row.Cells[5].Format.Alignment = ParagraphAlignment.Left;
             * row.Cells[5].VerticalAlignment = VerticalAlignment.Bottom;
             * row.Cells[5].MergeDown = 1;
             *
             *
             * row = table.AddRow();
             * row.HeadingFormat = true;
             * row.Format.Alignment = ParagraphAlignment.Center;
             * row.Format.Font.Bold = true;
             * row.Shading.Color = MigraDoc.DocumentObjectModel.Colors.BlueViolet;
             * row.Cells[1].AddParagraph("Quantity");
             * row.Cells[1].Format.Alignment = ParagraphAlignment.Left;
             * row.Cells[2].AddParagraph("Unit Price");
             * row.Cells[2].Format.Alignment = ParagraphAlignment.Left;
             * row.Cells[3].AddParagraph("Discount (%)");
             * row.Cells[3].Format.Alignment = ParagraphAlignment.Left;
             * row.Cells[4].AddParagraph("Taxable");
             * row.Cells[4].Format.Alignment = ParagraphAlignment.Left;
             */


            Column column = table.AddColumn(Unit.FromInch(0.31));

            column.Format.Alignment = ParagraphAlignment.Center;

            column = table.AddColumn(Unit.FromInch(2.0));
            column.Format.Alignment = ParagraphAlignment.Right;

            column = table.AddColumn(Unit.FromInch(0.8));
            column.Format.Alignment = ParagraphAlignment.Right;

            column = table.AddColumn(Unit.FromInch(1.0));
            column.Format.Alignment = ParagraphAlignment.Right;

            Row row = table.AddRow();

            row.HeadingFormat    = true;
            row.Format.Alignment = ParagraphAlignment.Center;
            row.Format.Font.Bold = true;
            row.Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)100, (byte)125, (byte)254));
            row.Cells[0].AddParagraph("Okaloosa County Property Appraiser  -  2013 Certified Values");
            row.Cells[0].Format.Font.Bold  = false;
            row.Cells[0].Format.Alignment  = ParagraphAlignment.Center;
            row.Cells[0].VerticalAlignment = VerticalAlignment.Center;
            row.Cells[0].MergeRight        = 3;

            row = table.AddRow();
            row.Shading.Color = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)255, (byte)236, (byte)255));
            row.Cells[0].AddParagraph("Parcel: " + obCama.pinstr);
            row.Cells[0].Format.Font.Bold  = false;
            row.Cells[0].Format.Alignment  = ParagraphAlignment.Left;
            row.Cells[0].VerticalAlignment = VerticalAlignment.Center;
            row.Cells[0].MergeRight        = 3;


            row = table.AddRow();
            row.Cells[0].Shading.Color = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)100, (byte)125, (byte)254));
            row.Cells[0].AddParagraph("Name");
            row.Cells[0].Format.Alignment = ParagraphAlignment.Left;

            row.Cells[1].AddParagraph(obCama.owner);
            row.Cells[1].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)255, (byte)236, (byte)255));
            row.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            row.Cells[2].AddParagraph("Land Value:");
            row.Cells[2].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)100, (byte)125, (byte)254));
            row.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            row.Cells[3].AddParagraph("$" + String.Format("{0:#,#######0}", obCama.landval));
            row.Cells[3].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)255, (byte)236, (byte)255));
            row.Cells[3].Format.Alignment = ParagraphAlignment.Left;



            row = table.AddRow();
            row.Cells[0].Shading.Color = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)100, (byte)125, (byte)254));
            row.Cells[0].AddParagraph("Site");
            row.Cells[0].Format.Alignment = ParagraphAlignment.Left;

            row.Cells[1].AddParagraph(obCama.site_addr);
            row.Cells[1].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)255, (byte)236, (byte)255));
            row.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            row.Cells[2].AddParagraph("Building Value");
            row.Cells[2].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)100, (byte)125, (byte)254));
            row.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            row.Cells[3].AddParagraph("$" + String.Format("{0:#,#######0}", obCama.bldval));
            row.Cells[3].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)255, (byte)236, (byte)255));
            row.Cells[3].Format.Alignment = ParagraphAlignment.Left;



            row = table.AddRow();
            row.Cells[0].Shading.Color = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)100, (byte)125, (byte)254));
            row.Cells[0].AddParagraph("Sale");
            row.Cells[0].Format.Alignment = ParagraphAlignment.Left;

            row.Cells[1].AddParagraph(obCama.sale_info);
            row.Cells[1].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)255, (byte)236, (byte)255));
            row.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            row.Cells[2].AddParagraph("Misc Value");
            row.Cells[2].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)100, (byte)125, (byte)254));
            row.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            row.Cells[3].AddParagraph("$" + String.Format("{0:#,#######0}", obCama.miscval));
            row.Cells[3].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)255, (byte)236, (byte)255));
            row.Cells[3].Format.Alignment = ParagraphAlignment.Left;


            row = table.AddRow();
            row.Cells[0].Shading.Color = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)100, (byte)125, (byte)254));
            row.Cells[0].AddParagraph("\nMail\n");
            row.Cells[0].Format.Alignment = ParagraphAlignment.Left;

            row.Cells[0].MergeDown = 3;

            //row.Cells[1].AddParagraph(obCama.mail_addr);
            row.Cells[1].AddParagraph(obCama.mail_addr_1);
            row.Cells[1].AddParagraph(obCama.mail_addr_2);

            row.Cells[1].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)255, (byte)236, (byte)255));
            row.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            row.Cells[1].MergeDown        = 3;

            row.Cells[2].AddParagraph("Just Value");
            row.Cells[2].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)100, (byte)125, (byte)254));
            row.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            row.Cells[3].AddParagraph("$" + String.Format("{0:#,#######0}", obCama.justval));
            row.Cells[3].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)255, (byte)236, (byte)255));
            row.Cells[3].Format.Alignment = ParagraphAlignment.Left;


            row = table.AddRow();

            row.Cells[2].AddParagraph("Assessed Value");
            row.Cells[2].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)100, (byte)125, (byte)254));
            row.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            row.Cells[3].AddParagraph("$" + String.Format("{0:#,#######0}", obCama.assdval));
            row.Cells[3].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)255, (byte)236, (byte)255));
            row.Cells[3].Format.Alignment = ParagraphAlignment.Left;



            row = table.AddRow();

            row.Cells[2].AddParagraph("Exempt Value");
            row.Cells[2].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)100, (byte)125, (byte)254));
            row.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            row.Cells[3].AddParagraph("$" + String.Format("{0:#,#######0}", obCama.exempt_val));
            row.Cells[3].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)255, (byte)236, (byte)255));
            row.Cells[3].Format.Alignment = ParagraphAlignment.Left;



            row = table.AddRow();

            row.Cells[2].AddParagraph("Taxable Value");
            row.Cells[2].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)100, (byte)125, (byte)254));
            row.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            row.Cells[3].AddParagraph("$" + String.Format("{0:#,#######0}", obCama.taxblval));
            row.Cells[3].Shading.Color    = MigraDoc.DocumentObjectModel.Color.FromRgbColor((byte)255, new MigraDoc.DocumentObjectModel.Color((byte)255, (byte)236, (byte)255));
            row.Cells[3].Format.Alignment = ParagraphAlignment.Left;


            // Create a renderer and prepare (=layout) the document
            //MigraDoc.Rendering.DocumentRenderer docRenderer = new DocumentRenderer(doc);
            docRenderer.PrepareDocument();

            // Render the paragraph. You can render tables or shapes the same way.
            docRenderer.RenderObject(gfx, XUnit.FromInch(0.4025), XUnit.FromInch(7.88), XUnit.FromInch(3.85), table);

            //table.SetEdge(0, 0, 2, 2, Edge.Box, MigraDoc.DocumentObjectModel.BorderStyle.Single, 0.75, MigraDoc.DocumentObjectModel.Colors.Yellow);

            // table.SetEdge(0, 0, 6, 2, Edge.Box, MigraDoc.DocumentObjectModel.BorderStyle.Single, 0.75, MigraDoc.DocumentObjectModel.Colors.Yellow);


            XFont    font2       = new XFont("Verdana", 5, XFontStyle.Regular);
            DateTime tdate       = DateTime.Now;
            String   datestr     = tdate.ToString("MMM dd,yyy");
            String   metadataMSG = String.Format("map created {0}", datestr);

            gfx.DrawString(metadataMSG, font2, XBrushes.Black, new XRect(480, 769, 100, 20), XStringFormats.Center);

            /*
             * double xp = 0;
             * double yp = 0;
             * int numticks = 10;
             *
             * double w_inc = page.Width.Value / (double)numticks;
             * double h_inc = page.Height.Value / (double)numticks;
             *
             * for (int x = 0; x < numticks; x++)
             * {
             * for (int y = 0; y < numticks; y++)
             * {
             *
             *     xp = (double)x * w_inc;
             *     yp = (double)y * h_inc;
             *
             *     XUnit xu_x = new XUnit(xp, XGraphicsUnit.Point);
             *     XUnit xu_y = new XUnit(yp, XGraphicsUnit.Point);
             *
             *     xu_x.ConvertType(XGraphicsUnit.Inch);
             *     xu_y.ConvertType(XGraphicsUnit.Inch);
             *
             *     gfx.DrawString("+", font, XBrushes.Red, new XRect( xp,  yp, 5, 5), XStringFormats.Center);
             *     String lbl = String.Format("{0},{1}-{2},{3}", (int)xp, (int)yp, xu_x.Value, xu_y.Value);
             *     gfx.DrawString(lbl, font, XBrushes.Red, new XRect( xp + 5,  yp + 5, 5, 5), XStringFormats.Center);
             *
             *
             * }
             *
             * }
             */
        }
Beispiel #15
0
        /// <summary>
        /// Adds learning data
        /// </summary>
        /// <param name="document">Document - pdf document</param>
        /// <param name="mat">MatrixMB - matrix object</param>
        private static void AddMatrixTable(Document document, LearnByErrorLibrary.MatrixMB mat)
        {
            try
            {
                var name = "Dane wejściowe" + " " + (mat.Name != "" ? " - " + mat.Name : "");
                Paragraph paragraph = document.LastSection.AddParagraph(name, "Heading2");
                paragraph.AddBookmark("Dane wejściowe");
                Table table = new Table();
                table.Borders.Width = 0.75;

                for (int col = 0; col < mat.Cols; col++)
                {
                    Column column = table.AddColumn(Unit.FromCentimeter(1.5));
                    column.Format.Alignment = ParagraphAlignment.Center;
                }

                for (int r = 0; r < mat.Rows; r++)
                {
                    Row row = table.AddRow();
                    row.Shading.Color = r % 2 == 0 ? Colors.LightGray : Colors.LightBlue;
                    for (int c = 0; c < mat.Cols; c++)
                    {
                        Cell cell = row.Cells[c];

                        cell.AddParagraph(mat.Data[r][c].ToString());
                    }
                }

                table.SetEdge(0, 0, mat.Cols, mat.Rows, Edge.Box, BorderStyle.Single, 0.5, Colors.Black);

                document.LastSection.Add(table);

            }
            catch (Exception ex)
            {
                ex.ToLog();
            }
        }
Beispiel #16
0
        private void RightSide(IPdfStyling pdfStyling, Section section)
        {
            MigraDoc.DocumentObjectModel.Tables.Table table = section.AddTable();

            table.TopPadding    = 0;
            table.RightPadding  = 0;
            table.BottomPadding = 0;
            table.LeftPadding   = 0;
            table.Borders.Width = 0;

            table.Rows.LeftIndent = GetTableIndent(pdfStyling);
            table.AddColumn(_tableLeftWidth);
            table.AddColumn(_tableRightWidth);

            Row row = table.AddRow();

            Cell header = row.Cells[0];

            header.MergeRight = 1;

            Paragraph logoWrapper = header.AddParagraph();

            logoWrapper.Format.Alignment = ParagraphAlignment.Center;

            Image logo = logoWrapper.AddImage(@"D:\DEVELOPMENT\GIT\OPTEN Solutions\tests\Opten.Web.Infrastructure.Pdf.Test\Images\logo_rimuss_secco.jpg");

            logo.LockAspectRatio           = true;
            logo.Height                    = Unit.FromMillimeter(18);
            logoWrapper.Format.SpaceBefore = 0;
            logoWrapper.Format.SpaceAfter  = Unit.FromCentimeter(1);

            Paragraph h1 = header.AddParagraph();

            h1.AddText("WINTER-BOWLE");
            h1.Format.Font.Size = 16;
            //h1.Format.Font.Bold = true;
            h1.Format.SpaceBefore = 0;
            h1.Format.SpaceAfter  = Unit.FromCentimeter(0.5);
            h1.Format.Alignment   = ParagraphAlignment.Center;

            h1.AddBookmark("Receipt1");
            h1.Format.OutlineLevel = OutlineLevel.Level1;

            TextFrame pWrapper = header.AddTextFrame();

            pWrapper.Height = Unit.FromCentimeter(1);
            pWrapper.Width  = _leftSideWidth;
            Paragraph p = pWrapper.AddParagraph();

            p.Format.Font.Color      = pdfStyling.ParagraphSmallColor;
            p.Format.LineSpacing     = Unit.FromCentimeter(0.5);
            p.Format.LineSpacingRule = LineSpacingRule.AtLeast;
            p.Format.SpaceAfter      = Unit.FromCentimeter(-0.25);        // Line spacing
            p.AddText("Warum eigentlich eine Fruchtbowle nur im Sommer geniessen?\nDiese Bowleiessen?\nDiese Bowle verhilft auch an kalten und unliessen?\nDiese Bowle verhilft auch an kalten und unl verhilft auch an kalten und unlustigen Winterabenden zu\neiner beschwingten Leichtigkeit.");
            p.Format.Alignment = ParagraphAlignment.Center;

            HorizontalRule(pdfStyling, header);

            Paragraph h2 = header.AddParagraph();

            h2.AddText("ZUBEREITUNG FÜR 1 GLAS");
            h2.Format.Font.Size   = 12;
            h2.Format.SpaceBefore = 0;
            h2.Format.SpaceAfter  = Unit.FromCentimeter(0.5);
            h2.Format.LeftIndent  = Unit.FromCentimeter(1);
            h2.Format.Alignment   = ParagraphAlignment.Left;

            IDictionary <string, string> rows = new Dictionary <string, string> {
                { "frische Babyananas", "1" },
                { "Kiwi", "1" },
                { "Clementine, alle Früchte schneiden", "1" },
                { "Zitrone, Saft", "1" },
                { "Esslöffel Zucker, ales mischen", "1" },
                { "Secco dazugiessen, zugedeckt", "7 dl" },
                { "kühl stellen", "ca. 1 Std." },
                { "kaltes Mineralwasser kurz vor dem Servieren dazugiessen", "3 dl" }
            };

            Table(pdfStyling, table, rows);

            row = table.AddRow();

            Cell bottom = row.Cells[0];

            bottom.MergeRight = 1;

            Paragraph small = bottom.AddParagraph();

            small.AddText("Deko: 1 Schnitz Grapefruit");
            small.Format.SpaceBefore = Unit.FromCentimeter(0.5);
            small.Format.SpaceAfter  = 0;
            small.Format.LeftIndent  = Unit.FromCentimeter(1);
            small.Format.Font.Size   = 10;
            small.Format.Font.Color  = pdfStyling.ParagraphSmallColor;
            small.Format.Alignment   = ParagraphAlignment.Left;

            HorizontalRule(pdfStyling, bottom);
        }
Beispiel #17
0
        private void CreateColumns(Table table)
        {
            try {
                Column column = table.AddColumn("4cm");
                column.Format.Alignment = ParagraphAlignment.Center;

                foreach (var timeSlot in this.timeSlots) {
                    column = table.AddColumn("3cm");
                    column.Format.Alignment = ParagraphAlignment.Center;
                }
            } catch {
                throw new BusinessLogicException($"Could not create PDF-File columns.");
            }
        }
        public void Render(IPdfStyling pdfStyling, Section section)
        {
            Unit height = Unit.FromCentimeter(3) + Unit.FromCentimeter(0.7 * 10);             // 3cm from top and bottom + cm per line

            TextFrame space = section.AddTextFrame();

            space.Height = ((pdfStyling.MaxHeightInPoints - height) / 2) - Unit.FromCentimeter(1);             // -1cm from margin-top of horizontal rule
            space.Width  = pdfStyling.MaxHeightInPoints;

            HorizontalRule(pdfStyling, section);

            Paragraph h2 = section.AddParagraph();

            h2.AddText("INHALTSVERZEICHNIS");
            h2.Format.Font.Size   = 12;
            h2.Format.SpaceBefore = 0;
            h2.Format.SpaceAfter  = Unit.FromCentimeter(0.5);
            h2.Format.LeftIndent  = Unit.FromCentimeter(1);
            h2.Format.Alignment   = ParagraphAlignment.Left;

            MigraDoc.DocumentObjectModel.Tables.Table table = section.AddTable();

            table.TopPadding    = 0;
            table.RightPadding  = 0;
            table.BottomPadding = 0;
            table.LeftPadding   = 0;
            table.Borders.Width = 0;

            table.Rows.LeftIndent = Unit.FromCentimeter(1);
            table.AddColumn(pdfStyling.MaxWidthInPoints / 2);
            table.AddColumn(pdfStyling.MaxWidthInPoints / 2);

            Row row = table.AddRow();

            IDictionary <int, string> pages = new Dictionary <int, string>
            {
                { 1, "frische Babyananas" },
                { 2, "frische Babyananas" },
                { 3, "frische Babyananas" },
                { 4, "frische Babyananas" },
                { 5, "frische Babyananas" },
                { 6, "frische Babyananas" },
                { 7, "frische Babyananas" },
                { 8, "frische Babyananas" },
                { 9, "frische Babyananas" },
                { 10, "frische Babyananas" },
                { 11, "frische Babyananas" },
                { 12, "frische Babyananas" },
                { 13, "frische Babyananas" },
                { 14, "frische Babyananas" },
                { 15, "frische Babyananas" },
                { 16, "frische Babyananas" },
                { 17, "frische Babyananas" },
                { 18, "frische Babyananas" },
                { 19, "frische Babyananas" },
                { 20, "frische Babyananas" }
            };

            decimal numberOfGroups = 2;
            int     counter        = 0;
            int     groupSize      = Convert.ToInt32(Math.Ceiling(pages.Count / numberOfGroups));

            var result = pages.GroupBy(x => counter++ / groupSize);

            int       cellIndex = 0;
            Font      font;
            Paragraph paragraph;
            Hyperlink hyperlink;

            foreach (IEnumerable <KeyValuePair <int, string> > group in result)
            {
                foreach (KeyValuePair <int, string> page in group)
                {
                    paragraph = row.Cells[cellIndex].AddParagraph();
                    paragraph.Format.Font.Size  = 10;
                    paragraph.Format.Font.Color = pdfStyling.ParagraphSmallColor;
                    if (cellIndex == 1)
                    {
                        paragraph.Format.LeftIndent = Unit.FromCentimeter(1);
                    }

                    font       = paragraph.Format.Font.Clone();
                    font.Color = pdfStyling.FontColor;

                    paragraph.Format.AddTabStop("2.5cm", TabAlignment.Left, TabLeader.Lines);

                    hyperlink = paragraph.AddHyperlink("Receipt1");
                    hyperlink.AddFormattedText(page.Key.ToString(), font);
                    hyperlink.AddTab();
                    hyperlink.AddFormattedText(page.Value, font);
                }
                cellIndex++;
            }

            HorizontalRule(pdfStyling, section);

            Footer(pdfStyling, section);

            section.AddPageBreak();
        }
        static void Main(string[] args)
        {
            using (CachedCsvReader csv = new CachedCsvReader(new StreamReader(@"e:\1.txt"), false, '\t'))       //http://www.codeproject.com/Articles/9258/A-Fast-CSV-Reader?msg=1294084#xx1294084xx
            {                                                                                                   //CachedCsvReader is used for MoveTo() method

                # region PDFinitialization

                Document document = new Document();
                Style style = document.Styles["Normal"];
                style.Font.Name = "Tahoma";
                style.Font.Size = 8;

                Section section = document.AddSection();
                //section.AddParagraph("Hello, World!");

                section.AddParagraph();

                Paragraph paragraph = section.AddParagraph();
                paragraph.Format.Font.Color = Color.FromCmyk(100, 30, 20, 50);
                //paragraph.AddFormattedText("Hello, World!", TextFormat.Underline);
                //AddFormattedText also returns an object:
                //FormattedText ft = paragraph.AddFormattedText("Small text",
                //  TextFormat.Bold);
                //ft.Font.Size = 6;

                csv.MoveTo(1);
                document.LastSection.AddParagraph("Sample: " + csv[1] + ", Date and time: " + csv[2], "Heading2");
                document.LastSection.AddParagraph();

                Table table = new Table();
                table.Borders.Width = 0.75;

                //Table table2 = new Table();
                //table2.Borders.Width = 0.75;
                //Column column2 = table2.AddColumn(Unit.FromCentimeter(3));
                //column2.Format.Alignment = ParagraphAlignment.Center;

                Column column = table.AddColumn(Unit.FromCentimeter(3));    //1st column
                column.Format.Alignment = ParagraphAlignment.Center;

                column.Table.AddColumn(Unit.FromCentimeter(2));             //2nd column
                column.Format.Alignment = ParagraphAlignment.Right;

                column.Table.AddColumn(Unit.FromCentimeter(2));             //3rd column
                column.Format.Alignment = ParagraphAlignment.Center;

                column.Table.AddColumn(Unit.FromCentimeter(2));             //4th column
                column.Format.Alignment = ParagraphAlignment.Center;

                column.Table.AddColumn(Unit.FromCentimeter(2));             //5th column
                column.Format.Alignment = ParagraphAlignment.Center;

                column.Table.AddColumn(Unit.FromCentimeter(2));             //6th column
                column.Format.Alignment = ParagraphAlignment.Center;

                column.Table.AddColumn(Unit.FromCentimeter(2));             //7th column
                column.Format.Alignment = ParagraphAlignment.Center;

                Row row = table.AddRow();
                row.Shading.Color = Colors.PaleGoldenrod;
                Cell cell = row.Cells[0];

                cell.AddParagraph("Measurement no.");

                row.Cells[1].AddParagraph("FW");
                row.Cells[2].AddParagraph("FWN");
                row.Cells[3].AddParagraph("HWL");
                row.Cells[4].AddParagraph("HWNL");
                row.Cells[5].AddParagraph("HWR");
                row.Cells[6].AddParagraph("HWNR");

                # endregion PDFinitialization

                #region loops

                for (int i = 0; i < 12; i=i+11)
                {

                    for (int j = 1; j < 10; j++)
                    {

                        csv.MoveTo(j); //row
                        //Console.Write(string.Format("{0} ", csv[i]));

                        FW.Add(double.Parse(csv[3], CultureInfo.InvariantCulture));
                        FWN.Add(double.Parse(csv[4], CultureInfo.InvariantCulture));
                        HWL.Add(double.Parse(csv[5], CultureInfo.InvariantCulture));
                        HWNL.Add(double.Parse(csv[6], CultureInfo.InvariantCulture));
                        HWR.Add(double.Parse(csv[7], CultureInfo.InvariantCulture));
                        HWNR.Add(double.Parse(csv[8], CultureInfo.InvariantCulture));

                        table.AddRow();

                        table.Rows[j - i].Cells[0].AddParagraph((j - i).ToString());
                        table.Rows[j - i].Cells[1].AddParagraph(csv[3]);
                        table.Rows[j - i].Cells[2].AddParagraph(csv[4]);
                        table.Rows[j - i].Cells[3].AddParagraph(csv[5]);
                        table.Rows[j - i].Cells[4].AddParagraph(csv[6]);
                        table.Rows[j - i].Cells[5].AddParagraph(csv[7]);
                        table.Rows[j - i].Cells[6].AddParagraph(csv[8]);

                        var descrStatFW = new DescriptiveStatistics(FW);
                        double KurtosisHW = descrStatFW.Kurtosis;
                        double SkewnessHW = descrStatFW.Skewness;

                        var descrStatFWN = new DescriptiveStatistics(FWN);
                        double KurtosisFWN = descrStatFWN.Kurtosis;
                        double SkewnessFWN = descrStatFWN.Skewness;

                        var descrStatHWL = new DescriptiveStatistics(HWL);
                        double KurtosisHWL = descrStatHWL.Kurtosis;
                        double SkewnessHWL = descrStatHWL.Skewness;

                        var descrStatHWNL = new DescriptiveStatistics(HWNL);
                        double KurtosisHWNL = descrStatHWNL.Kurtosis;
                        double SkewnessHWNL = descrStatHWNL.Skewness;

                        var descrStatHWR = new DescriptiveStatistics(HWR);
                        double KurtosisHWR = descrStatHWR.Kurtosis;
                        double SkewnessHWR = descrStatHWR.Skewness;

                        var descrStatHWNR = new DescriptiveStatistics(HWNR);
                        double KurtosisHWNR = descrStatHWNR.Kurtosis;
                        double SkewnessHWNR = descrStatHWNR.Skewness;

                        var histogram = new Histogram(FW, 4);
                        //double bucket3count = histogram[3].Count;
                        //double bucket3count = histogram.UpperBound;
                        //double bucket3count = histogram.DataCount;
                        //double bucket3count = histogram.BucketCount;
                        //double bucket3count = histogram[2].Width;                   //width of the bin
                        double bucket3count = histogram[0].LowerBound;                //histogram[0].LowerBound=histogram.LowerBound

                        Console.WriteLine();
                        Console.WriteLine(string.Format("{0} ", FW.Mean()));
                        Console.WriteLine();
                        Console.WriteLine(string.Format("{0} ", FW.StandardDeviation()));

                        Console.WriteLine();
                        Console.WriteLine(string.Format("{0} ", KurtosisHW));
                        Console.WriteLine();
                        Console.WriteLine(string.Format("{0} ", SkewnessHW));
                        Console.WriteLine();
                        Console.WriteLine(string.Format("{0} ", bucket3count));

                        row = table.AddRow();
                        row.Shading.Color = Colors.PaleGoldenrod;
                        cell = row.Cells[0];
                        cell.AddParagraph("Mean");
                        cell = row.Cells[1];
                        cell.AddParagraph(Math.Round(FW.Mean(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[10].Cells[2].AddParagraph(Math.Round(FWN.Mean(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[10].Cells[3].AddParagraph(Math.Round(HWL.Mean(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[10].Cells[4].AddParagraph(Math.Round(HWNL.Mean(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[10].Cells[5].AddParagraph(Math.Round(HWR.Mean(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[10].Cells[6].AddParagraph(Math.Round(HWNR.Mean(), 2).ToString(CultureInfo.InvariantCulture));

                        row = table.AddRow();
                        row.Shading.Color = Colors.PaleGoldenrod;
                        cell = row.Cells[0];
                        cell.AddParagraph("Standard dev.");
                        cell = row.Cells[1];
                        cell.AddParagraph(Math.Round(FW.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[11].Cells[2].AddParagraph(Math.Round(FWN.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[11].Cells[3].AddParagraph(Math.Round(HWL.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[11].Cells[4].AddParagraph(Math.Round(HWNL.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[11].Cells[5].AddParagraph(Math.Round(HWR.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[11].Cells[6].AddParagraph(Math.Round(HWNR.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));

                        row = table.AddRow();
                        row.Shading.Color = Colors.PaleGoldenrod;
                        cell = row.Cells[0];
                        cell.AddParagraph("2x Standard dev.");
                        cell = row.Cells[1];
                        cell.AddParagraph(Math.Round(2 * FW.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[12].Cells[2].AddParagraph(Math.Round(2 * FWN.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[12].Cells[3].AddParagraph(Math.Round(2 * HWL.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[12].Cells[4].AddParagraph(Math.Round(2 * HWNL.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[12].Cells[5].AddParagraph(Math.Round(2 * HWR.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[12].Cells[6].AddParagraph(Math.Round(2 * HWNR.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));

                        row = table.AddRow();
                        row.Shading.Color = Colors.PaleGoldenrod;
                        cell = row.Cells[0];
                        cell.AddParagraph("3x Standard dev.");
                        cell = row.Cells[1];
                        cell.AddParagraph(Math.Round(3 * FW.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[13].Cells[2].AddParagraph(Math.Round(3 * FWN.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[13].Cells[3].AddParagraph(Math.Round(3 * HWL.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[13].Cells[4].AddParagraph(Math.Round(3 * HWNL.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[13].Cells[5].AddParagraph(Math.Round(3 * HWR.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[13].Cells[6].AddParagraph(Math.Round(3 * HWNR.StandardDeviation(), 2).ToString(CultureInfo.InvariantCulture));

                        row = table.AddRow();
                        row.Shading.Color = Colors.PaleGoldenrod;
                        cell = row.Cells[0];
                        cell.AddParagraph("Min");
                        cell = row.Cells[1];
                        cell.AddParagraph(Math.Round(FW.Min(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[14].Cells[2].AddParagraph(Math.Round(FWN.Min(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[14].Cells[3].AddParagraph(Math.Round(HWL.Min(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[14].Cells[4].AddParagraph(Math.Round(HWNL.Min(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[14].Cells[5].AddParagraph(Math.Round(HWR.Min(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[14].Cells[6].AddParagraph(Math.Round(HWNR.Min(), 2).ToString(CultureInfo.InvariantCulture));

                        row = table.AddRow();
                        row.Shading.Color = Colors.PaleGoldenrod;
                        cell = row.Cells[0];
                        cell.AddParagraph("Max");
                        cell = row.Cells[1];
                        cell.AddParagraph(Math.Round(FW.Max(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[15].Cells[2].AddParagraph(Math.Round(FWN.Max(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[15].Cells[3].AddParagraph(Math.Round(HWL.Max(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[15].Cells[4].AddParagraph(Math.Round(HWNL.Max(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[15].Cells[5].AddParagraph(Math.Round(HWR.Max(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[15].Cells[6].AddParagraph(Math.Round(HWNR.Max(), 2).ToString(CultureInfo.InvariantCulture));

                        row = table.AddRow();
                        row.Shading.Color = Colors.PaleGoldenrod;
                        cell = row.Cells[0];
                        cell.AddParagraph("Median");
                        cell = row.Cells[1];
                        cell.AddParagraph(Math.Round(FW.Median(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[16].Cells[2].AddParagraph(Math.Round(FWN.Median(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[16].Cells[3].AddParagraph(Math.Round(HWL.Median(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[16].Cells[4].AddParagraph(Math.Round(HWNL.Median(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[16].Cells[5].AddParagraph(Math.Round(HWR.Median(), 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[16].Cells[6].AddParagraph(Math.Round(HWNR.Median(), 2).ToString(CultureInfo.InvariantCulture));

                        row = table.AddRow();
                        row.Shading.Color = Colors.PaleGoldenrod;
                        cell = row.Cells[0];
                        cell.AddParagraph("Kurtosis");
                        cell = row.Cells[1];
                        cell.AddParagraph(Math.Round(KurtosisHW, 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[17].Cells[2].AddParagraph(Math.Round(KurtosisFWN, 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[17].Cells[3].AddParagraph(Math.Round(KurtosisHWL, 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[17].Cells[4].AddParagraph(Math.Round(KurtosisHWNL, 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[17].Cells[5].AddParagraph(Math.Round(KurtosisHWR, 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[17].Cells[6].AddParagraph(Math.Round(KurtosisHWNR, 2).ToString(CultureInfo.InvariantCulture));

                        row = table.AddRow();
                        row.Shading.Color = Colors.PaleGoldenrod;
                        cell = row.Cells[0];
                        cell.AddParagraph("Skewness");
                        cell = row.Cells[1];
                        cell.AddParagraph(Math.Round(SkewnessHW, 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[18].Cells[2].AddParagraph(Math.Round(SkewnessFWN, 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[18].Cells[3].AddParagraph(Math.Round(SkewnessHWL, 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[18].Cells[4].AddParagraph(Math.Round(SkewnessHWNL, 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[18].Cells[5].AddParagraph(Math.Round(SkewnessHWR, 2).ToString(CultureInfo.InvariantCulture));
                        table.Rows[18].Cells[6].AddParagraph(Math.Round(SkewnessHWNR, 2).ToString(CultureInfo.InvariantCulture));

                        //table.SetEdge(0, 0, 2, 3, Edge.Box, BorderStyle.Single, 1.5, Colors.Black);

                        document.LastSection.Add(table);

                        PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(false,
                        PdfFontEmbedding.Always);
                        pdfRenderer.Document = document;
                        pdfRenderer.RenderDocument();
                        string filename = "Sample_" + FileIndex.ToString() + ".pdf";
                        pdfRenderer.PdfDocument.Save(filename);
                    }

                    FileIndex++;
                }

                #endregion

                //PdfDocument inputDocument1 = PdfReader.Open("HelloWorld4.pdf", PdfDocumentOpenMode.Import);
                //PdfDocument inputDocument2 = PdfReader.Open("HelloWorld5.pdf", PdfDocumentOpenMode.Import);

                //PdfDocument outputDocument = new PdfDocument();

                // Show consecutive pages facing. Requires Acrobat 5 or higher.
                //outputDocument.PageLayout = PdfPageLayout.TwoColumnLeft;

                //// Iterate pages
                //int count = inputDocument.PageCount;
                //for (int idx = 0; idx < count; idx++)
                //{
                //    // Get the page from the external document...
                //    PdfPage page = inputDocument.Pages[idx];
                //    // ...and add it to the output document.
                //    outputDocument.AddPage(page);
                //}

                // Get some file names
                //string[] files = GetFiles();
                string[] files = { "Sample_1.pdf", "Sample_2.pdf" };

                // Open the output document
                PdfDocument outputDocument = new PdfDocument();

                // Iterate files
                foreach (string file in files)
                {
                    // Open the document to import pages from it.
                    PdfDocument inputDocument = PdfReader.Open(file, PdfDocumentOpenMode.Import);

                    // Iterate pages
                    int count = inputDocument.PageCount;
                    for (int idx = 0; idx < count; idx++)
                    {
                        // Get the page from the external document...
                        PdfPage page = inputDocument.Pages[idx];
                        // ...and add it to the output document.
                        outputDocument.AddPage(page);
                    }
                }

                // Save the document...
                const string filenameCombined = "ConcatenatedDocument1_tempfile.pdf";
                outputDocument.Save(filenameCombined);
                // ...and start a viewer.
                //Process.Start(filename);

            }
Beispiel #20
0
        public Document CreateSample1(TreeViewItem item)
        {
            _connection.Open();
            _mySqlCommand.CommandText = @"SELECT
                DATE_FORMAT(defectsdata.DatePr,'%Y-%m-%d'),
                worksmens.NameSmen,
                sizetubes.SizeTube,
                gosts.NameGost,
                controlsamples.NameControlSample,
                o1.Surname,
                o1.LevelMD,
                o2.Surname,
                o2.LevelMD,
                device.NameDevice,
                defectsdata.Porog,
                defectsdata.Current,
                Count(defectsdata.IndexData),
                (SELECT
                Count(defectsdata.IndexData)
                FROM
                defectsdata
                Inner Join indexes ON defectsdata.IndexData = indexes.IndexData
                Inner Join worksmens ON worksmens.Id_WorkSmen = indexes.Id_WorkSmen
                WHERE
                defectsdata.FlDefectTube = 1 AND
                defectsdata.NumberTube <> 0 AND
                defectsdata.DatePr = '2013-12-25' AND
                indexes.Id_WorkSmen = 3
                )
                FROM
                defectsdata
                Inner Join indexes ON defectsdata.IndexData = indexes.IndexData
                Inner Join worksmens ON worksmens.Id_WorkSmen = indexes.Id_WorkSmen
                Inner Join sizetubes ON sizetubes.Id_SizeTube = indexes.Id_SizeTube
                Inner Join gosts ON gosts.Id_Gost = indexes.Id_Gost
                Inner Join controlsamples ON controlsamples.Id_ControlSample = indexes.Id_ControlSample
                Inner Join operators AS o1 ON o1.Id_Operator = indexes.Id_Operator1
                Inner Join operators AS o2 ON o2.Id_Operator = indexes.Id_Operator2
                Inner Join device ON device.Id_Device = indexes.Id_Device
                WHERE DATE_FORMAT(defectsdata.DatePr, '%Y-%m-%d') = @A AND
                indexes.Id_WorkSmen = @B AND
                defectsdata.NumberTube <> 0
                GROUP BY defectsdata.DatePr
                LIMIT 1
            ";
            _mySqlCommand.Parameters.Clear();
            _mySqlCommand.Parameters.AddWithValue("A", item.Uid.Split('|')[0]);
            _mySqlCommand.Parameters.AddWithValue("B", item.Uid.Split('|')[1]);
            _mySqlCommand.Connection = _connection.MySqlConnection;
            _mySqlDataReader = _mySqlCommand.ExecuteReader();

            // Create a new MigraDoc document
            var document = new Document();
            // Add a section to the document
            var section = document.AddSection();
            // Add a paragraph to the section
            var paragraph = section.AddParagraph();

            while (_mySqlDataReader.Read())
            {
                Title = "Отчет за " + _mySqlDataReader.GetString(0) + " по смене " + _mySqlDataReader.GetString(1);
                paragraph.AddText("ОАО \"Северский трубный завод\"\r\nТЭСЦ-2 стан 73-219");
                paragraph.Format.Font.Size = "14";
                paragraph.Format.Alignment = ParagraphAlignment.Center;

                paragraph = section.AddParagraph();
                paragraph = section.AddParagraph();
                paragraph.AddText("Сводная информация по смене");
                paragraph.Format.Font.Size = "12";
                paragraph.Format.Alignment = ParagraphAlignment.Center;
                document.LastSection.AddParagraph();
                var table = new Table();
                table.Format.Font.Size = "11";
                table.Borders.Width = 0.5;

                var column = table.AddColumn(Unit.FromCentimeter(8));
                //column.Format.Alignment = ParagraphAlignment.Center;

                table.AddColumn(Unit.FromCentimeter(10));

                var padding = 8;

                var row = table.AddRow();
                row.BottomPadding = padding;
                Cell cell = row.Cells[0];
                cell.AddParagraph("Дата");
                cell = row.Cells[1];
                cell.AddParagraph(_mySqlDataReader.GetString(0));

                row = table.AddRow();
                row.BottomPadding = padding;
                cell = row.Cells[0];
                cell.AddParagraph("Смена");
                cell = row.Cells[1];
                cell.AddParagraph(_mySqlDataReader.GetString(1));

                row = table.AddRow();
                row.BottomPadding = padding;
                cell = row.Cells[0];
                cell.AddParagraph("Типоразмер труб");
                cell = row.Cells[1];
                cell.AddParagraph(_mySqlDataReader.GetString(2));

                row = table.AddRow();
                row.BottomPadding = padding;
                cell = row.Cells[0];
                cell.AddParagraph("Нормативные документы");
                cell = row.Cells[1];
                cell.AddParagraph(_mySqlDataReader.GetString(3));

                row = table.AddRow();
                row.BottomPadding = padding;
                cell = row.Cells[0];
                cell.AddParagraph("Контрольный образец");
                cell = row.Cells[1];
                cell.AddParagraph(_mySqlDataReader.GetString(4));

                row = table.AddRow();
                row.BottomPadding = padding;
                cell = row.Cells[0];
                cell.AddParagraph("Специалист ОКПП");
                cell = row.Cells[1];
                cell.AddParagraph(_mySqlDataReader.GetString(5));

                row = table.AddRow();
                row.BottomPadding = padding;
                cell = row.Cells[0];
                cell.AddParagraph("Уровень по МПР (FT)");
                cell = row.Cells[1];
                cell.AddParagraph(_mySqlDataReader.GetString(6));

                row = table.AddRow();
                row.BottomPadding = padding;
                cell = row.Cells[0];
                cell.AddParagraph("Специалист АСК ТЭСЦ-2");
                cell = row.Cells[1];
                cell.AddParagraph(_mySqlDataReader.GetString(7));

                row = table.AddRow();
                row.BottomPadding = padding;
                cell = row.Cells[0];
                cell.AddParagraph("Уровень по МПР (FT)");
                cell = row.Cells[1];
                cell.AddParagraph(_mySqlDataReader.GetString(8));

                row = table.AddRow();
                row.BottomPadding = padding;
                cell = row.Cells[0];
                cell.AddParagraph("Параметры настройки");
                cell = row.Cells[1];
                cell.AddParagraph();

                row = table.AddRow();
                row.BottomPadding = padding;
                cell = row.Cells[0];
                cell.AddParagraph("Автоматический контроль шва");
                cell = row.Cells[1];
                cell.AddParagraph();

                row = table.AddRow();
                row.BottomPadding = padding;
                cell = row.Cells[0];
                cell.AddParagraph("Установка");
                cell = row.Cells[1];
                cell.AddParagraph(_mySqlDataReader.GetString(9));

                row = table.AddRow();
                row.BottomPadding = padding;
                cell = row.Cells[0];
                cell.AddParagraph("Порог, мВ");
                cell = row.Cells[1];
                cell.AddParagraph(_mySqlDataReader.GetString(10));

                row = table.AddRow();
                row.BottomPadding = padding;
                cell = row.Cells[0];
                cell.AddParagraph("Ток, А");
                cell = row.Cells[1];
                cell.AddParagraph(_mySqlDataReader.GetString(11));

                row = table.AddRow();
                row.BottomPadding = padding;
                cell = row.Cells[0];
                cell.AddParagraph("Проконтролировано труб");
                cell = row.Cells[1];
                cell.AddParagraph(_mySqlDataReader.GetString(12));

                row = table.AddRow();
                row.BottomPadding = padding;
                cell = row.Cells[0];
                cell.AddParagraph("Дефектных труб");
                cell = row.Cells[1];
                cell.AddParagraph(_mySqlDataReader.GetString(13));

                //table.SetEdge(0, 0, 2, 3, Edge.Box, BorderStyle.Single, 1.5, Colors.Black);

                document.LastSection.Add(table);
            }
            _mySqlDataReader.Close();
            _connection.Close();

            return document;
        }
Beispiel #21
0
        private void SetTableHeader(ref Table table, Color tableColor)
        {
            var columns = new Dictionary<string, Dictionary<string, ParagraphAlignment>>();
            columns.Add("#", new Dictionary<string, ParagraphAlignment>
            {
                {"1cm", ParagraphAlignment.Center}
            });
            columns.Add("Title", new Dictionary<string, ParagraphAlignment>
            {
                {"6cm", ParagraphAlignment.Left}
            });
            var taxesEnabled = _taxSettings.TaxesEnabled;
            var columnWidth = taxesEnabled ? "2cm" : "3cm";
            columns.Add("Qty", new Dictionary<string, ParagraphAlignment>
            {
                {columnWidth, ParagraphAlignment.Center}
            });
            columns.Add("Unit Price" + (taxesEnabled ? " (ex TAX)" : ""), new Dictionary<string, ParagraphAlignment>
            {
                {columnWidth, ParagraphAlignment.Right}
            });
            if (taxesEnabled)
            {
                columns.Add("Tax Rate", new Dictionary<string, ParagraphAlignment>
                {
                    {columnWidth, ParagraphAlignment.Right}
                });
            }
            columns.Add("Net Sub Total", new Dictionary<string, ParagraphAlignment>
            {
                {"3cm", ParagraphAlignment.Right}
            });

            foreach (var item in columns)
            {
                Column column = table.AddColumn(item.Value.First().Key);
                column.Format.Alignment = item.Value.First().Value;
            }

            Row row = table.AddRow();
            row.HeadingFormat = true;
            row.Format.Alignment = ParagraphAlignment.Center;
            row.Format.Font.Bold = true;
            row.Shading.Color = tableColor;
            row.TopPadding = 2;
            row.BottomPadding = 2;
            int rowId = 0;
            foreach (var item in columns)
            {
                row.Cells[rowId].AddParagraph(item.Key);
                row.Cells[rowId].Format.Alignment = ParagraphAlignment.Center;
                rowId++;
            }

            table.SetEdge(0, 0, 5, 1, Edge.Box, BorderStyle.Single, 0.75, Color.Empty);
        }
Beispiel #22
0
        /// <summary>
        /// Learing weights
        /// </summary>
        /// <param name="document">Document - pdf document</param>
        /// <param name="result">LearnResult - learn result</param>
        private static void DefineWeightsSection(Document document, LearnResult result)
        {
            Section section = document.AddSection();
            document.LastSection.AddParagraph("Wagi otrzymane w procesie uczenia", "Heading2");
            Paragraph paragraph = section.AddParagraph("Wagi otrzymane w procesie uczenia dla: " + Path.GetFileNameWithoutExtension(result.Filename) + "\r\n");
            paragraph.AddBookmark("Wagi otrzymane w procesie uczenia");
            paragraph.Format.SpaceAfter = "3cm";
            paragraph.Format.Font.Size = 16;
            paragraph.Format.Font.Color = Colors.Black;
            paragraph.Format.SpaceBefore = "1cm";
            paragraph.Format.SpaceAfter = "1cm";

            int i = 1;
            foreach (var item in result.ResultWeights)
            {
                paragraph = section.AddParagraph("\r\n" + "Wagi otrzymane z uczenia dla próby nr: " + i.ToString() + "\r\n");
                paragraph.Format.SpaceAfter = "3cm";
                paragraph.Format.Font.Size = 16;
                paragraph.Format.Font.Color = Colors.Black;
                paragraph.Format.SpaceBefore = "1cm";
                paragraph.Format.SpaceAfter = "1cm";
                Table table = new Table();

                table.Borders.Width = 0.75;
                Column column = table.AddColumn(Unit.FromCentimeter(1.5));
                column.Format.Alignment = ParagraphAlignment.Center;
                Column column2 = table.AddColumn(Unit.FromCentimeter(5.5));
                column2.Format.Alignment = ParagraphAlignment.Center;

                int w = 1;

                Row _row = table.AddRow();
                Cell _cell1 = _row.Cells[0];
                _cell1.AddParagraph("Numer wagi");

                Cell _cell2 = _row.Cells[1];
                _cell2.AddParagraph("Waga");
                foreach (var weight in item)
                {
                    Row row = table.AddRow();
                    Cell cell1 = row.Cells[0];
                    cell1.AddParagraph(w.ToString());

                    Cell cell2 = row.Cells[1];
                    cell2.AddParagraph(weight.ToString());
                    w++;
                }
                paragraph.Section.Add(table);
                //document.LastSection.Add(table);

                i++;
            }
        }
Beispiel #23
0
        /// <summary>
        /// Write the specified table to the TextWriter.
        /// </summary>
        /// <param name="writer">The writer to write to</param>
        /// <param name="table">The table to write</param>
        /// <param name="outtype">Indicates the format to be produced</param>
        /// <param name="className">The class name of the generated html table</param>
        /// <param name="document">Document object if using MigraDoc to generate output, null otherwise </param>
        private static void WriteTable(TextWriter writer, DataTable table, OutputType outtype, string className, Document document)
        {
            bool showHeadings = className != "PropertyTable";
            if (outtype == OutputType.html)
            {
                if (showHeadings)
                {
                    writer.WriteLine("<table class='headered'>");
                    writer.Write("<tr>");
                    for (int i = 0; i < table.Columns.Count; i++)
                    {
                        writer.Write("<th");
                        if (i == 0)
                            writer.Write(" class='col1'");
                        writer.Write(">" + table.Columns[i].ColumnName + "</th>");
                    }
                }
                else
                    writer.WriteLine("<table>");

                foreach (DataRow row in table.Rows)
                {
                    bool titleRow = Convert.IsDBNull(row[0]);
                    if (titleRow)
                        writer.Write("<tr class='total'>");
                    else
                        writer.Write("<tr>");

                    for (int i = 0; i < table.Columns.Count; i++)
                    {
                        string st;
                        if (titleRow && i == 0)
                            st = "Total";
                        else
                            st = row[i].ToString();

                        writer.Write("<td");
                        if (i == 0)
                            writer.Write(" class='col1'");
                        writer.Write(">");
                        writer.Write(st);
                        writer.Write("</td>");
                    }
                    writer.WriteLine("</tr>");
                }
                writer.WriteLine("</table><br/>");
            }
            else if (outtype == OutputType.rtf)
            {
                Table tabl = new Table();
                tabl.Borders.Width = 0.75;

                foreach (DataColumn col in table.Columns)
                {
                    Column column = tabl.AddColumn(Unit.FromCentimeter(18.0 / table.Columns.Count));
                }

                if (showHeadings)
                {
                    Row row = tabl.AddRow();
                    row.Shading.Color = Colors.PaleGoldenrod;
                    tabl.Shading.Color = new Color(245, 245, 255);
                    for (int i = 0; i < table.Columns.Count; i++)
                    {
                        Cell cell = row.Cells[i];
                        Paragraph paragraph = cell.AddParagraph();
                        if (i == 0)
                            paragraph.Format.Alignment = ParagraphAlignment.Left;
                        else
                            paragraph.Format.Alignment = ParagraphAlignment.Right;
                        paragraph.AddText(table.Columns[i].ColumnName);
                    }
                }

                foreach (DataRow row in table.Rows)
                {
                    bool titleRow = Convert.IsDBNull(row[0]);
                    string st;
                    Row newRow = tabl.AddRow();

                    for (int i = 0; i < table.Columns.Count; i++)
                    {
                        if (titleRow && i == 0)
                        {
                            st = "Total";
                            newRow.Format.Font.Color = Colors.DarkOrange;
                            newRow.Format.Font.Bold = true;
                        }
                        else
                            st = row[i].ToString();

                        Cell cell = newRow.Cells[i];
                        Paragraph paragraph = cell.AddParagraph();
                        if (!showHeadings)
                        {
                            cell.Borders.Style = BorderStyle.None;
                            paragraph.Format.Alignment = ParagraphAlignment.Left;
                        }
                        else if (i == 0)
                            paragraph.Format.Alignment = ParagraphAlignment.Left;
                        else
                            paragraph.Format.Alignment = ParagraphAlignment.Right;

                        if (showHeadings && i == 0)
                            paragraph.AddFormattedText(st, TextFormat.Bold);
                        else
                            paragraph.AddText(st);
                    }
                }

                document.LastSection.Add(tabl);
                document.LastSection.AddParagraph(); // Just to give a bit of spacing
            }
            else
            {
                DataTableUtilities.DataTableToText(table, 0, "  ", showHeadings, writer);
            }
        }
Beispiel #24
0
        /// <summary>
        /// Main page
        /// </summary>
        /// <param name="document">Document - pdf document</param>
        /// <param name="result">LearnResult - learning result</param>
        private void DefineInfo(Document document, LearnResult result)
        {
            Section section = document.AddSection();
            document.LastSection.AddParagraph("Informacje na temat sieci neuronowej", "Heading2");
            Paragraph paragraph = section.AddParagraph("Informacje na temat sieci neuronowej" + "\r\n");
            paragraph.AddBookmark("Informacje na temat sieci neuronowej");
            paragraph.Format.SpaceAfter = "3cm";
            paragraph.Format.Font.Size = 16;
            paragraph.Format.Font.Color = Colors.Black;
            paragraph.Format.SpaceBefore = "1cm";
            paragraph.Format.SpaceAfter = "1cm";

            Table table = new Table();
            table.Borders.Width = 0.75;
            Column column = table.AddColumn(Unit.FromCentimeter(10.0));
            column.Format.Alignment = ParagraphAlignment.Left;
            Column column2 = table.AddColumn(Unit.FromCentimeter(5.5));
            column2.Format.Alignment = ParagraphAlignment.Center;

            Row _row = table.AddRow();
            Cell _cell1 = _row.Cells[0];
            _cell1.AddParagraph("Nazwa parametru");

            Cell _cell2 = _row.Cells[1];
            _cell2.AddParagraph("Wartość parametru");

            foreach (var item in result.GetInformation())
            {
                Row row = table.AddRow();
                Cell cell1 = row.Cells[0];
                cell1.AddParagraph(item[0]);

                Cell cell2 = row.Cells[1];
                cell2.AddParagraph(item[1]);
            }

            document.LastSection.Add(table);
        }
Beispiel #25
0
        public static Table CreateSimpleTableWithoutHeader(string[] strArrayColumnSize, string[][] strMatrixContent, string fontName, Color fontColor, Unit fontSize, double borderSize, double edgeSize, ParagraphAlignment alignment)
        {
            Table table = new Table();
            table.Borders.Width = borderSize;

            for (int i = 0; i < strArrayColumnSize.GetLength(0); i++)
            {
                table.AddColumn(strArrayColumnSize[i]);
            }

            Row row;
            Cell cell;

            for (int i = 0; i < strMatrixContent.GetLength(0); i++)
            {
                row = table.AddRow();
                row.Format.Alignment = alignment;
                row.Format.Font.Bold = false;
                row.Format.Font.Name = fontName;
                row.Format.Font.Color = fontColor;
                row.Format.Font.Size = fontSize;

                string[] strArrayContent = strMatrixContent[i];

                for (int j = 0; j < strArrayContent.GetLength(0); j++)
                {
                    cell = row.Cells[j];
                    if (strArrayContent[j].Contains(".jpg") || strArrayContent[j].Contains(".png"))
                    {
                        Image image = new Image(strArrayContent[j]);
                        image.Width = strArrayColumnSize[j];
                        cell.Add(image);
                    }
                    else
                    {
                        cell.AddParagraph(strArrayContent[j]);
                    }
                }
            }

            table.SetEdge(0, 0, strArrayColumnSize.GetLength(0), strMatrixContent.GetLength(0), Edge.Box, BorderStyle.Single, edgeSize, Colors.Black);
            return table;
        }
Beispiel #26
0
        public static void CreatePage(Document document, Ventana ventana)
        {
            MigraDoc.DocumentObjectModel.Tables.Table table = new MigraDoc.DocumentObjectModel.Tables.Table();
            table.Borders.Width = 0.5;

            Column column = table.AddColumn(MigraDoc.DocumentObjectModel.Unit.FromCentimeter(4));

            column.Format.Alignment = ParagraphAlignment.Left;

            table.AddColumn(MigraDoc.DocumentObjectModel.Unit.FromCentimeter(12.5));

            Row row = table.AddRow();

            row.Shading.Color = Colors.White;
            Cell cell = row.Cells[0];

            row.Cells[0].MergeRight = 1;

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("PO:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.PO);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("Recursos:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.Recurso);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("Cantidades (#pp):");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.Cantidad);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("Linea Transportista:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.Carrier.NombreCorto);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("Operador:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.Conductor);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("Movil:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.MovilConductor);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("Origen:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.Procedencia.NombreCorto);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("Destino:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.Destino.NombreCorto);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("Fecha:");
            cell = row.Cells[1];
            cell.AddParagraph((ventana.Evento.FechaInicio).ToString());

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("No ECO Tractor:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.NumeroEconomico);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("Placas Tractor:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.NumeroPlaca);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("No Caja/Contenedor:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.EconomicoRemolque);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("Placas Caja/Contenedor:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.PlacaRemolque);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("Modelo:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.ModeloContenedor);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("Color:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.ColorContenedor);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("Tipo Unidad:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.TipoUnidad);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("Dimensión:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.Dimension);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("Sellos:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.Sellos);

            row = table.AddRow();
            row.Format.Font.Size = 6;
            cell = row.Cells[0];
            cell.AddParagraph("Temperatura Controlada:");
            cell = row.Cells[1];
            cell.AddParagraph(ventana.Temperatura);

            table.SetEdge(0, 0, 2, 20, Edge.Box, MigraDoc.DocumentObjectModel.BorderStyle.Single, .5, Colors.Black);

            document.LastSection.Add(table);
        }
        private void createTimesheetSection()
        {
            //Go through all the timesheets and create the table for each.  
            //Title only occurs on first day
            Section currentSection = (Section)serviceSheetDoc.Sections.LastObject;
            timesheetTable = currentSection.AddTable();

            //Setup the table columns and borders
            Column tableColumnn = timesheetTable.AddColumn(COLUMN_ONE_WIDTH);
            tableColumnn = timesheetTable.AddColumn(COLUMN_TWO_WIDTH);
            timesheetTable.Borders.Color = tableBorderColour;
            timesheetTable.Borders.Width = borderWidth;

            int counter = 0;
            foreach (ServiceDayViewModel sd in currentSheet.AllServiceDays.AllServiceDayVMs)
            {
                if (counter == 0)
                {
                    Row row1Title = timesheetTable.AddRow();
                    row1Title.Cells[0].MergeRight = 1;
                    Paragraph jobDetailsPara = row1Title.Cells[0].AddParagraph();
                    jobDetailsPara.AddFormattedText("T", "allCapsFirstLetter");
                    jobDetailsPara.AddFormattedText("IMESHEET ", "allCapsNextLetter");
                    row1Title.Cells[0].Shading.Color = headerGrey;
                }
                
                addDayToTimesheet(sd, counter);

                counter = counter + 1;
            }
            

            //int noOfDays = currentSheet.ServiceTimesheets.Count;
            //int counter = 0;

            //while (counter < noOfDays)
            //{
            //    if (counter ==0)
            //    {
            //        Row row1Title = timesheetTable.AddRow();
            //        row1Title.Cells[0].MergeRight = 1;
            //        Paragraph jobDetailsPara = row1Title.Cells[0].AddParagraph();
            //        jobDetailsPara.AddFormattedText("T", "allCapsFirstLetter");
            //        jobDetailsPara.AddFormattedText("IMESHEET ", "allCapsNextLetter");
            //        row1Title.Cells[0].Shading.Color = headerGrey;
            //    }

            //    oldServiceDayModel currentDay = currentSheet.ServiceTimesheets[counter];
            //    addDayToTimesheet(currentDay, counter);

            //    counter = counter + 1;
            //}

            //Add a gap before the next section
            currentSection.AddParagraph();
        }
Beispiel #28
0
        public static void CreateHeader(Document document)
        {
            MigraDoc.DocumentObjectModel.Tables.Table header = new MigraDoc.DocumentObjectModel.Tables.Table();
            header.Shading.Color     = Colors.MidnightBlue;
            header.Format.Font.Color = Colors.White;
            header.Format.Alignment  = ParagraphAlignment.Center;
            header.Format.Font.Bold  = true;

            Column h_column = header.AddColumn(MigraDoc.DocumentObjectModel.Unit.FromCentimeter(4));

            h_column.Format.Alignment = ParagraphAlignment.Center;

            h_column = header.AddColumn("2.5cm");
            h_column.Format.Alignment = ParagraphAlignment.Center;

            h_column = header.AddColumn("2.5cm");
            h_column.Format.Alignment = ParagraphAlignment.Center;

            h_column = header.AddColumn("2.5cm");
            h_column.Format.Alignment = ParagraphAlignment.Center;

            h_column = header.AddColumn("2.5cm");
            h_column.Format.Alignment = ParagraphAlignment.Center;

            h_column = header.AddColumn("2.5cm");
            h_column.Format.Alignment = ParagraphAlignment.Center;

            Row  h_row  = header.AddRow();
            Cell h_cell = h_row.Cells[5];

            h_row  = header.AddRow();
            h_cell = h_row.Cells[0];
            h_row.Cells[0].MergeDown = 2;
            h_cell.AddImage(HttpContext.Current.Server.MapPath("~/img/pmm-mini.png")).Width = "3.5cm";
            h_cell = h_row.Cells[1];
            h_cell.VerticalAlignment = VerticalAlignment.Top;
            h_cell.AddParagraph("Datos del Transporte");
            h_row.Cells[1].MergeRight = 4;

            h_row = header.AddRow();
            h_row.HeadingFormat     = true;
            h_row.Format.Font.Size  = 6;
            h_row.VerticalAlignment = VerticalAlignment.Top;
            h_cell = h_row.Cells[1];
            h_cell.AddParagraph("Código del Formato:");
            h_cell = h_row.Cells[2];
            h_cell.AddParagraph("Fecha de Efectividad:");
            h_cell = h_row.Cells[3];
            h_cell.AddParagraph("Tiempo de Retención:");
            h_cell = h_row.Cells[4];
            h_cell.AddParagraph("Versión:");
            h_cell = h_row.Cells[5];
            h_cell.AddParagraph("Página:");

            h_row = header.AddRow();
            h_row.Format.Font.Size = 6;
            h_cell = h_row.Cells[1];
            h_cell.AddParagraph("QM0474.F01");
            h_cell = h_row.Cells[2];
            h_cell.AddParagraph(DateTime.Now.ToString());
            h_cell = h_row.Cells[3];
            h_cell.AddParagraph("");
            h_cell = h_row.Cells[4];
            h_cell.AddParagraph("1.0");
            h_cell = h_row.Cells[5];
            h_cell.AddParagraph("1 de 1");

            header.SetEdge(0, 0, 6, 4, Edge.Box, MigraDoc.DocumentObjectModel.BorderStyle.Single, .5, Colors.Black);
            document.LastSection.Add(header);
        }
        public void CreatePage(MainQuote lVGquote)
        {
            var model =
               (from r in db.section1Model
            where r.id == lVGquote.Section1ModelId
            select r).SingleOrDefault();

            Section section = document.AddSection();

            // --------------------------PAGE 1----------------------------------------------------
            // masnory domuslift
            //Image image;
            if (lVGquote.ShaftType == "Masonry")
            {
                if (lVGquote.LiftType == "DomusLift")
                {
                    Image image = section.AddImage(HttpContext.Current.Server.MapPath("~\\Content\\Logo\\DomusLift Masonry Shaft Header .jpg"));
                    image.Height = "6.6cm";
                    image.LockAspectRatio = true;
                    image.RelativeVertical = RelativeVertical.Line;
                    image.RelativeHorizontal = RelativeHorizontal.Margin;
                    image.Top = ShapePosition.Top;
                    image.Left = ShapePosition.Center;
                    image.WrapFormat.Style = WrapStyle.Through;
                }
                else if (lVGquote.LiftType == "DomusXL")
                {
                    Image image = section.AddImage(HttpContext.Current.Server.MapPath("~\\Content\\Logo\\DomusLift Masonry Shaft Header .jpg"));
                    image.Height = "6.6cm";
                    image.LockAspectRatio = true;
                    image.RelativeVertical = RelativeVertical.Line;
                    image.RelativeHorizontal = RelativeHorizontal.Margin;
                    image.Top = ShapePosition.Top;
                    image.Left = ShapePosition.Center;
                    image.WrapFormat.Style = WrapStyle.Through;
                }
                else if (lVGquote.LiftType == "Domus Evolution")
                {
                    Image image = section.AddImage(HttpContext.Current.Server.MapPath("~\\Content\\Logo\\Domus Evolution Masonry Tender Header.jpg"));
                    image.Height = "6.6cm";
                    image.LockAspectRatio = true;
                    image.RelativeVertical = RelativeVertical.Line;
                    image.RelativeHorizontal = RelativeHorizontal.Margin;
                    image.Top = ShapePosition.Top;
                    image.Left = ShapePosition.Center;
                    image.WrapFormat.Style = WrapStyle.Through;
                }
                else if (lVGquote.LiftType == "Domus Spirit")
                {
                    Image image = section.AddImage(HttpContext.Current.Server.MapPath("~\\Content\\Logo\\Domus Spirit Tender Template .jpg"));
                    image.Height = "6.6cm";
                    image.LockAspectRatio = true;
                    image.RelativeVertical = RelativeVertical.Line;
                    image.RelativeHorizontal = RelativeHorizontal.Margin;
                    image.Top = ShapePosition.Top;
                    image.Left = ShapePosition.Center;
                    image.WrapFormat.Style = WrapStyle.Through;
                }
                else if (lVGquote.LiftType == "DomusXL Spirit")
                {
                    Image image = section.AddImage(HttpContext.Current.Server.MapPath("~\\Content\\Logo\\Domus Spirit Tender Template .jpg"));
                    image.Height = "6.6cm";
                    image.LockAspectRatio = true;
                    image.RelativeVertical = RelativeVertical.Line;
                    image.RelativeHorizontal = RelativeHorizontal.Margin;
                    image.Top = ShapePosition.Top;
                    image.Left = ShapePosition.Center;
                    image.WrapFormat.Style = WrapStyle.Through;
                }
            }
            else
            {
                if (lVGquote.LiftType == "DomusLift")
                {
                    Image image = section.AddImage(HttpContext.Current.Server.MapPath("~\\Content\\Logo\\DomusLift Glass Tower - Tender Header.jpg"));
                    image.Height = "6.6cm";
                    image.LockAspectRatio = true;
                    image.RelativeVertical = RelativeVertical.Line;
                    image.RelativeHorizontal = RelativeHorizontal.Margin;
                    image.Top = ShapePosition.Top;
                    image.Left = ShapePosition.Center;
                    image.WrapFormat.Style = WrapStyle.Through;
                }
                else if (lVGquote.LiftType == "DomusXL")
                {
                    Image image = section.AddImage(HttpContext.Current.Server.MapPath("~\\Content\\Logo\\DomusLift Glass Tower - Tender Header.jpg"));
                    image.Height = "6.6cm";
                    image.LockAspectRatio = true;
                    image.RelativeVertical = RelativeVertical.Line;
                    image.RelativeHorizontal = RelativeHorizontal.Margin;
                    image.Top = ShapePosition.Top;
                    image.Left = ShapePosition.Center;
                    image.WrapFormat.Style = WrapStyle.Through;
                }
                else if (lVGquote.LiftType == "Domus Evolution")
                {
                    Image image = section.AddImage(HttpContext.Current.Server.MapPath("~\\Content\\Logo\\Domus Evolution Glass Tower - Tender Header.jpg"));
                    image.Height = "6.6cm";
                    image.LockAspectRatio = true;
                    image.RelativeVertical = RelativeVertical.Line;
                    image.RelativeHorizontal = RelativeHorizontal.Margin;
                    image.Top = ShapePosition.Top;
                    image.Left = ShapePosition.Center;
                    image.WrapFormat.Style = WrapStyle.Through;
                }
                else if (lVGquote.LiftType == "Domus Spirit")
                {
                    Image image = section.AddImage(HttpContext.Current.Server.MapPath("~\\Content\\Logo\\Domus Spirit Tender Template .jpg"));
                    image.Height = "6.6cm";
                    image.LockAspectRatio = true;
                    image.RelativeVertical = RelativeVertical.Line;
                    image.RelativeHorizontal = RelativeHorizontal.Margin;
                    image.Top = ShapePosition.Top;
                    image.Left = ShapePosition.Center;
                    image.WrapFormat.Style = WrapStyle.Through;
                }
                else if (lVGquote.LiftType == "DomusXL Spirit")
                {
                    Image image = section.AddImage(HttpContext.Current.Server.MapPath("~\\Content\\Logo\\Domus Spirit Tender Template .jpg"));
                    image.Height = "6.6cm";
                    image.LockAspectRatio = true;
                    image.RelativeVertical = RelativeVertical.Line;
                    image.RelativeHorizontal = RelativeHorizontal.Margin;
                    image.Top = ShapePosition.Top;
                    image.Left = ShapePosition.Center;
                    image.WrapFormat.Style = WrapStyle.Through;
                }
            }

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

            paragraph.Format.Alignment = ParagraphAlignment.Right;
            paragraph.AddFormattedText("Page no  : ", TextFormat.Bold);
            paragraph.AddPageField();
            paragraph.AddText("  ");
            paragraph.AddFormattedText("Initial: _________", TextFormat.Bold);
            paragraph.AddLineBreak();

            paragraph1.AddFormattedText("Project Name: ", TextFormat.Bold);
            paragraph1.AddText(model.ProjectName);
            //            paragraph1.AddLineBreak();
            paragraph1.AddFormattedText("  Quote No: ", TextFormat.Bold);
            paragraph1.AddText("P" + model.id + "-" + lVGquote.id);
            paragraph1.AddLineBreak();
            paragraph1.AddText("Copyright © 2010 Easy Living Home Elevators Pty Limited - Commercial in Confidence   V270315");
            paragraph1.Format.Font.Size = 9;
            paragraph1.Format.Alignment = ParagraphAlignment.Center;
            paragraph1.AddLineBreak();

            if (model.Branch == "NSW")
            {

                addressFrame = section.AddTextFrame();
                addressFrame.Height = "2.0cm";
                addressFrame.Width = "9.5cm";
                addressFrame.Left = ShapePosition.Right;
                addressFrame.RelativeHorizontal = RelativeHorizontal.Margin;

                addressFrame.Top = "5.5cm";
                addressFrame.RelativeVertical = RelativeVertical.Page;

                paragraph = addressFrame.AddParagraph("Easy Living Home Elevators Pty Limited  ABN: 82 083 936 896 ");
                paragraph.Format.Font.Size = 10;
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph = addressFrame.AddParagraph("64 Penshurst St,Willoughby NSW 2068");
                paragraph.Format.Font.Size = 10;
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph = addressFrame.AddParagraph("Phone 02 8116 1500 / Fax 02 8116 1511");
                paragraph.Format.Font.Size = 10;
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph = addressFrame.AddParagraph("www.easy-living.com.au");
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph.Format.Font.Name = "Calibri";
                paragraph.Format.Font.Size = 10;
                paragraph.Format.SpaceAfter = 15;

            }
            else if (model.Branch == "VIC")
            {

                addressFrame = section.AddTextFrame();
                addressFrame.Height = "2.0cm";
                addressFrame.Width = "10.0cm";
                addressFrame.Left = ShapePosition.Right;
                addressFrame.RelativeHorizontal = RelativeHorizontal.Margin;
                addressFrame.Top = "5.5cm";
                addressFrame.RelativeVertical = RelativeVertical.Page;

                paragraph = addressFrame.AddParagraph("Easy Living Home Elevators (VIC) Pty Limited ABN: 91 136 701 865");
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph.Format.Font.Size = 9.5;
                paragraph = addressFrame.AddParagraph("7 Hoddle St,Collingwood VIC 3066");
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph.Format.Font.Size = 9.5;
                paragraph = addressFrame.AddParagraph("Phone 03 9094 8600 / Fax 03 9094 8611");
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph.Format.Font.Size = 9.5;
                paragraph = addressFrame.AddParagraph("www.easy-living.com.au");
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph.Format.Font.Size = 9.5;
                paragraph.Format.SpaceAfter = 0;

                paragraph = section.AddParagraph();
                paragraph.Format.SpaceBefore = "0cm";

            }
            else if (model.Branch == "QLD")
            {

                addressFrame = section.AddTextFrame();
                addressFrame.Height = "2.0cm";
                addressFrame.Width = "10.0cm";
                addressFrame.Left = ShapePosition.Right;
                addressFrame.RelativeHorizontal = RelativeHorizontal.Margin;
                addressFrame.Top = "5.5cm";
                addressFrame.RelativeVertical = RelativeVertical.Page;

                paragraph = addressFrame.AddParagraph("Easy Living Home Elevators (QLD) Pty Limited ABN: 85 136 701 838");
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph.Format.Font.Size = 9.5;
                paragraph = addressFrame.AddParagraph("17 Campbell Street, BOWEN HILLS QLD 4006");
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph.Format.Font.Size = 9.5;
                paragraph = addressFrame.AddParagraph("Phone 07 3851 7500 / Fax 07 3851 7511");
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph.Format.Font.Size = 9.5;
                paragraph = addressFrame.AddParagraph("www.easy-living.com.au");
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph.Format.Font.Size = 9.5;
                paragraph.Format.SpaceAfter = 0;

                paragraph = section.AddParagraph();
                paragraph.Format.SpaceBefore = "0cm";

            }
            else
            {

                addressFrame = section.AddTextFrame();
                addressFrame.Height = "2.0cm";
                addressFrame.Width = "10.0cm";
                addressFrame.Left = ShapePosition.Right;
                addressFrame.RelativeHorizontal = RelativeHorizontal.Margin;
                addressFrame.Top = "5.5cm";
                addressFrame.RelativeVertical = RelativeVertical.Page;

                paragraph = addressFrame.AddParagraph("Easy Living Home Elevators (WA) Pty Limited  ABN: 15 142 482 451");
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph.Format.Font.Size = 9.5;
                paragraph = addressFrame.AddParagraph("Unit 6/ 347-351 Great Eastern Hwy,REDCLIFFE WA 6104");
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph.Format.Font.Size = 9.5;
                paragraph = addressFrame.AddParagraph("Phone 08 9322 4688 / Fax  08 9322 4655");
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph.Format.Font.Size = 9.5;
                paragraph = addressFrame.AddParagraph("www.easy-living.com.au");
                paragraph.Format.Alignment = ParagraphAlignment.Right;
                paragraph.Format.Font.Name = "Calibri";
                paragraph.Format.Font.Size = 9.5;
                paragraph.Format.SpaceAfter = 0;

                paragraph = section.AddParagraph();
                paragraph.Format.SpaceBefore = "0cm";

            }
            paragraph = section.AddParagraph();
            paragraph = section.AddParagraph();
            paragraph = section.AddParagraph("");
            paragraph = section.AddParagraph("");
            paragraph.Format.SpaceBefore = "7cm";

            paragraph.AddText("DATE : ");
            paragraph.AddDateField("dd.MM.yyyy");
            paragraph.Format.Alignment = ParagraphAlignment.Left;
            paragraph.Format.SpaceAfter = 6;

            paragraph.Format.SpaceBefore = "7cm";
            paragraph = section.AddParagraph(model.ContactName);
            if (model.Company != null)
            {
                paragraph = section.AddParagraph(model.Company);
            }
            if (model.ContactAdress != null)
            {
                paragraph = section.AddParagraph(model.ContactAdress);

                paragraph = section.AddParagraph(model.ContactSuburb + ", " + model.ContactState + ", " + model.ContactPostCode);
            }
            paragraph.Format.SpaceAfter = 9;
            string LiftCodeComplence = "";
            if (lVGquote.CodeComplence == "Part 15")
            {
                LiftCodeComplence = "AS1735.15  Limited Mobility Lift";
            }

            else if (lVGquote.CodeComplence == "Part 18")
            {
                LiftCodeComplence = "AS1735.18  Private Residential Lift";

            }
            else
            {
                LiftCodeComplence = "AS1735.16  Limited Mobility Lift";

            }
            paragraph = section.AddParagraph(LiftCodeComplence);
            paragraph.Format.Font.Bold = true;

            if (lVGquote.ShaftType == "Tower")
            {
                paragraph = section.AddParagraph("The One and Only " + lVGquote.LiftType + " in shaft structure");
            }
            else
            {
                paragraph = section.AddParagraph("The one and Only " + lVGquote.LiftType);

            } paragraph.Format.Font.Bold = true;

            string Slogan = "";
            if (lVGquote.LiftType == "DomusLift")
            {
                Slogan = "The most bought home elevator in Australia";
            }
            else if (lVGquote.LiftType == "DomusXL")
            {
                Slogan = "The big cousin of Australia’s most popular home lift";

            }
            else if (lVGquote.LiftType == "Domus Evolution")
            {
                Slogan = "The next generation";

            }
            else if (lVGquote.LiftType == "Domus Spirit")
            {
                Slogan = "Exceptional value for money";

            }
            else
            {
                Slogan = "The more powerful DomusXL Spirit Lift, designed for optimum performance";

            }
            paragraph = section.AddParagraph(Slogan);
            paragraph.Format.Font.Bold = true;

            paragraph = section.AddParagraph();
            paragraph.AddLineBreak();
            paragraph.AddFormattedText("At Project Name: " + model.ProjectName, TextFormat.Bold);

            paragraph = section.AddParagraph();
            paragraph.AddLineBreak();
            paragraph.AddFormattedText("Order dated ______ / ______ / _______ is set out below");
            paragraph.Format.SpaceAfter = 8;

            paragraph.AddLineBreak();
            paragraph = section.AddParagraph("AUSTRALIA’S #1 IN HOME ELEVATORS");
            paragraph.Format.Font.Bold = true;
            string answer = model.ProjectType == "Commercial" ? "project" : "home";
            paragraph = section.AddParagraph("Welcoming luxury and convenience into your " + answer + " has never been so simple. Easy Living Home Elevators not only improve the value of your " + answer + ", but can also boost your quality of life");
            paragraph = section.AddParagraph("We’re specialists who’ve been leading the way in Australia for the last 16 years and are unchallenged across flexibility, quality, service and value");

            paragraph = section.AddParagraph();
            paragraph.Format.SpaceBefore = "0cm";
            paragraph.Style = "Reference";
            paragraph.AddLineBreak();
            paragraph.AddFormattedText("#1 FOR FLEXIBILITY", TextFormat.Bold);
            paragraph.AddLineBreak();
            paragraph.AddText("The ability to custom design your lift to specific requirements, allows our lifts to fit perfectly into your home and not the other way around.");
            Image image3 = section.AddImage(HttpContext.Current.Server.MapPath("~\\Content\\logo\\Made In Italy.jpg"));
            image3.Height = "2cm";
            image3.Width = "3cm";
            image3.LockAspectRatio = true;
            image3.RelativeVertical = RelativeVertical.Line;
            image3.RelativeHorizontal = RelativeHorizontal.Margin;
            image3.Left = ShapePosition.Right;
            image3.WrapFormat.Style = WrapStyle.Through;
            paragraph.AddLineBreak();
            paragraph = section.AddParagraph("#1 FOR QUALITY");
            paragraph.Format.Font.Bold = true;
            paragraph = section.AddParagraph("Our 100% European Quality Promise is coupled with the fact that Easy Living Home Elevators are the exclusive trusted suppliers of the DomusLift brand.");
            paragraph.Format.RightIndent = "4cm";
            paragraph = section.AddParagraph("Amazing Statistic: 27,500 DomusLifts are sold in over 40 countries worldwide and growing! You can be assured of the quality, reliability and back-up.");
            paragraph.Format.RightIndent = "4cm";
            paragraph.Format.SpaceAfter = 8;
            paragraph.AddLineBreak();
            paragraph = section.AddParagraph("#1 FOR SERVICE");
            paragraph.Format.Font.Bold = true;
            Image image2 = section.AddImage(HttpContext.Current.Server.MapPath("~\\Content\\logo\\Quality-ISO-9001-PMS302.gif")); //C:\Users\karen.mendes\Downloads\KarenProject\KarenProject\Content\Logo\Quality-ISO-9001-PMS302.gif
            image2.Height = "2cm";

            //image2.Width = "1cm";
            image2.LockAspectRatio = true;

            image2.RelativeVertical = RelativeVertical.Line;
            image2.RelativeHorizontal = RelativeHorizontal.Margin;
            image2.Left = ShapePosition.Right;
            image2.WrapFormat.Style = WrapStyle.Through;

            paragraph = section.AddParagraph("Easy Living Home Elevators has integrated with Google maps so you can see the popularity of our lifts in your area and know exactly where your service is coming from.");
            paragraph.Format.RightIndent = "3cm";

            paragraph = section.AddParagraph("We’re the clear #1 supplier of home elevators in Australia with 7,500+ in our maintenance system, which is over x3 our nearest competitor.");
            paragraph.Format.RightIndent = "3cm";

            paragraph = section.AddParagraph("");

            paragraph.AddLineBreak();

            // --------------------------PAGE 2----------------------------------------------------

            document.LastSection.AddPageBreak();
            paragraph = section.AddParagraph("#1 FOR VALUE");
            paragraph.Format.Font.Bold = true;
            paragraph = section.AddParagraph("We’re Australia’s largest home elevator company that’s still privately owned so we pass the savings on to you." +
                "Easy Living Home Elevators is the only specialist Home Elevator Company that holds certification to ISO9001," + "with internationally recognised processes in place to ensure you receive the lift you want……on time!");
            paragraph = section.AddParagraph();
            paragraph.AddLineBreak();
            paragraph = section.AddParagraph("SAFE AND SECURE");
            paragraph.Format.Font.Bold = true;
            paragraph = section.AddParagraph("The " + lVGquote.LiftType + " range has been developed with the paramount objective of providing users with the highest possible level of safety ensuring peace of mind.");
            paragraph = section.AddParagraph("- Ten (10) year parts availability guarantee");
            paragraph.Format.LeftIndent = "0.2cm";
            paragraph = section.AddParagraph("- In the event of mains power failure, the lift will return to the lowest floor with all safety features in place and unlock the door to allow passengers to exit");
            paragraph.Format.LeftIndent = "0.2cm";
            paragraph = section.AddParagraph("- 24/7 Call centre assistance: Every lift installed has access to our 24-hour call centre.");
            paragraph.Format.LeftIndent = "0.2cm";
            paragraph = section.AddParagraph("- Other safety features include: Emergency lighting, Emergency Alarm Button, over speed sensing safety gear, Electrical and Mechanical interlocks.");
            paragraph.Format.LeftIndent = "0.2cm";

            paragraph = section.AddParagraph();
            paragraph.AddLineBreak();
            paragraph.AddFormattedText("Our standard safety features that others consider optional extras are what make the " + lVGquote.LiftType + " different from any other elevators.", TextFormat.Bold); //2.4 lift type in the text before different
            Image image1 = section.AddImage(HttpContext.Current.Server.MapPath("~\\Content\\logo\\Easy Living Home Elevators showrooms.jpg"));
            image1.Height = "8cm";
            image1.Width = "8cm";
            image1.LockAspectRatio = true;
            image1.RelativeVertical = RelativeVertical.Line;
            image1.RelativeHorizontal = RelativeHorizontal.Margin;
            image1.Left = ShapePosition.Right;
            image1.WrapFormat.Style = WrapStyle.Through;
            paragraph.AddLineBreak();
            paragraph.AddLineBreak();
            paragraph = section.AddParagraph("WORKING LIFTS ON DISPLAY IN EVERY MAJOR CAPITAL CITY.");
            paragraph.Format.Font.Bold = true;
            paragraph = section.AddParagraph("We have world-class showrooms with flexible hours so we’re there when you need us.");
            paragraph.Format.RightIndent = "8.5cm";
            paragraph = section.AddParagraph("Our operational elevators are not simply put on display rather; they take centre stage, ready to transport you to the next level at the push of a button, demonstrating the latest technological advances, whisper quiet performance, style, innovation and durability.");
            paragraph.Format.RightIndent = "8.5cm";
            paragraph = section.AddParagraph("You are not just another number to us, as a valued client your lift is “Designed to Impress” to reflect your individual needs and taste. Your lift is about you, your life and your expectations.");

            paragraph.Format.RightIndent = "8.5cm";
            paragraph.Format.SpaceAfter = "2cm";
            paragraph = section.AddParagraph("Best Regards,");
            paragraph.Format.SpaceAfter = "2cm";
            paragraph.AddLineBreak();

            // Sales Person email   // GAJ TO DO
            paragraph = section.AddParagraph(model.SalesPerson);
            switch (model.SalesPerson)
            {
                case "Craig Schmidt":
                    {
                        paragraph = section.AddParagraph("*****@*****.**");
                        break;
                    }
                case "David Mayer":
                    {
                        paragraph = section.AddParagraph("*****@*****.**");

                        break;
                    }
                case "David Smith":
                    {
                        paragraph = section.AddParagraph("*****@*****.**");
                        break;
                    }
                case "Kevin Bunting":
                    {
                        paragraph = section.AddParagraph("*****@*****.**");
                        break;
                    }
                case "Michael Heltborg":
                    {
                        paragraph = section.AddParagraph("*****@*****.**");
                        break;
                    }

                case "Dijana Vojvodic":
                    {
                        paragraph = section.AddParagraph("*****@*****.**");
                        break;
                    }

                case "Robert Pizzie":
                    {
                        paragraph = section.AddParagraph("*****@*****.**");
                        break;
                    }

                case "Paul Solotwa":
                    {
                        paragraph = section.AddParagraph("*****@*****.**");
                        break;
                    }
                case "Mike Booth":
                    {
                        paragraph = section.AddParagraph(" [email protected]");
                        break;
                    }
            }
            // paragraph = section.AddParagraph("Email - ");

            paragraph = section.AddParagraph("Easy Living Home Elevators");
            document.LastSection.AddPageBreak();

            // --------------------------PAGE 3----------------------------------------------------

            paragraph = section.AddParagraph(lVGquote.LiftType + " SPECIFICATIONS (refer to " + lVGquote.LiftType + " brochure)");
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 13;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;

            table = section.AddTable();
            table.Style = "Table";
            table.Borders.Width = 0;
            table.Borders.Left.Width = 0;
            table.Borders.Right.Width = 0;
            table.Rows.LeftIndent = 0;

            paragraph = section.AddParagraph();
            paragraph = section.AddParagraph("GENERAL SPECIFICATION");
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 13;
            paragraph.Format.SpaceAfter = 5;

            table = section.AddTable();
            table.Style = "Table2";
            table.Borders.Width = 0;
            table.Borders.Left.Width = 0;
            table.Borders.Right.Width = 0;
            table.Rows.LeftIndent = 0;

            Column column = table.AddColumn("9cm");
            column.Format.Alignment = ParagraphAlignment.Center;

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

            Row row = table.AddRow();
            row.Format.Alignment = ParagraphAlignment.Center;
            row.Cells[0].AddParagraph("Lift Code Compliance:");
            row.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            row.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            row.Cells[1].AddParagraph(LiftCodeComplence);
            if (lVGquote.Part12 == true)
            {
                row.Cells[1].AddParagraph("AS1735.12 - Facilities for persons with Disabilities");
            }
            row.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row row1 = table.AddRow();
            row1.Format.Alignment = ParagraphAlignment.Center;
            row1.Cells[0].AddParagraph("No. of Lifts:");
            row1.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            row1.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            row1.Cells[1].AddParagraph(lVGquote.NoOfLifts.ToString());
            row1.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row row2 = table.AddRow();
            row2.Format.Alignment = ParagraphAlignment.Center;
            row2.Cells[0].AddParagraph("Shaft Type:");
            row2.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            row2.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            if (lVGquote.ShaftType == "Masonry")
            {
                row2.Cells[1].AddParagraph("Enclosed by client");
            }
            else if (lVGquote.ShaftType == "Tower")
            {
                row2.Cells[1].AddParagraph("Shaft structure");
            }
            else
            {
                row2.Cells[1].AddParagraph("Partial structure");
            }
            row2.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row row3 = table.AddRow();
            row3.Format.Alignment = ParagraphAlignment.Center;
            row3.Cells[0].AddParagraph("Lift Model:");
            row3.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            row3.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            row3.Cells[1].AddParagraph(lVGquote.LiftModel);
            row3.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row row4 = table.AddRow();
            row4.Format.Alignment = ParagraphAlignment.Center;
            paragraph = row4.Cells[0].AddParagraph();
            paragraph.AddText("Load Bearing Wall ");
            FormattedText formattedText5 = paragraph.AddFormattedText(" (as viewed from  landing):", TextFormat.Italic);
            formattedText5.Size = 9;
            row4.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            row4.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            paragraph = row4.Cells[1].AddParagraph();
            paragraph.AddText(lVGquote.LoadBearingWall + " hand side");
            FormattedText formattedText7 = paragraph.AddFormattedText(" - refer to works by others section 3", TextFormat.Italic);
            formattedText7.Size = 9;
            row4.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row row5 = table.AddRow();
            row5.Format.Alignment = ParagraphAlignment.Center;
            row5.Cells[0].AddParagraph("No. of Floors:");
            row5.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            row5.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            row5.Cells[1].AddParagraph(lVGquote.NoOfFloors.ToString());
            row5.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row row6 = table.AddRow();
            row6.Format.Alignment = ParagraphAlignment.Center;
            row6.Cells[0].AddParagraph("Entrance Type: ");
            row6.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            row6.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            row6.Cells[1].AddParagraph(lVGquote.EntranceType);
            row6.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row row7 = table.AddRow();
            row7.Format.Alignment = ParagraphAlignment.Center;
            row7.Cells[0].AddParagraph("Capacity:");
            row7.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            row7.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            row7.Cells[1].AddParagraph(lVGquote.Capacity == null ? "" : (lVGquote.Capacity.EndsWith(" Kg") ? lVGquote.Capacity : (lVGquote.Capacity + " Kg")));
            row7.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row row8 = table.AddRow();
            row8.Format.Alignment = ParagraphAlignment.Center;
            paragraph = row8.Cells[0].AddParagraph();
            paragraph.AddText("Speed ");
            FormattedText formattedText4 = paragraph.AddFormattedText(" (maximum) without lift car door:", TextFormat.Italic);
            formattedText4.Size = 9;
            row8.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            row8.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            row8.Cells[1].AddParagraph(lVGquote.Speed + "m/s");
            row8.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row row9 = table.AddRow();
            row9.Format.Alignment = ParagraphAlignment.Center;
            row9.Cells[0].AddParagraph("Drive System:");
            row9.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            row9.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            if (lVGquote.LiftType == "Domus Spirit" || lVGquote.LiftType == "DomusXL Spirit")
            {
                row9.Cells[1].AddParagraph("Direct Acting " + lVGquote.DriveSystem);
            }
            else
            {
                row9.Cells[1].AddParagraph("Roped Oil-" + lVGquote.DriveSystem + ", metal sheave");

            } row9.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row row10 = table.AddRow();
            row10.Format.Alignment = ParagraphAlignment.Center;
            row10.Cells[0].AddParagraph("Power Supply:");
            row10.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            row10.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            row10.Cells[1].AddParagraph(lVGquote.Power);
            row10.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row row11 = table.AddRow();
            row11.Format.Alignment = ParagraphAlignment.Center;
            row11.Cells[0].AddParagraph("Control Cabinet Size:");
            row11.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            row11.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            row11.Cells[1].AddParagraph(lVGquote.ConCabSize);
            row11.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row row12 = table.AddRow();
            row12.Format.Alignment = ParagraphAlignment.Center;
            paragraph = row12.Cells[0].AddParagraph();
            paragraph.AddText("Control Cabinet Location: ");
            FormattedText formattedText3 = paragraph.AddFormattedText(" (Distance from Shaft)", TextFormat.Italic);
            formattedText3.Size = 9;
            row12.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            row12.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            row12.Cells[1].AddParagraph("Vertical Distance: " + lVGquote.ConCabLocVer + " mm");
            row12.Cells[1].AddParagraph("Horizontal Distance: " + lVGquote.ConCabLocHor + " mm");
            row12.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            paragraph = section.AddParagraph();
            paragraph = section.AddParagraph("DIMENSIONS");
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 13;
            paragraph.Format.SpaceAfter = 5;

            table = section.AddTable();
            table.Style = "Table2";
            table.Borders.Width = 0;
            table.Borders.Left.Width = 0;
            table.Borders.Right.Width = 0;
            table.Rows.LeftIndent = 0;

            Column columndim = table.AddColumn("9cm");
            columndim.Format.Alignment = ParagraphAlignment.Center;

            columndim = table.AddColumn("9cm");
            columndim.Format.Alignment = ParagraphAlignment.Right;

            Row rowdim = table.AddRow();
            rowdim.Format.Alignment = ParagraphAlignment.Center;
            rowdim.Cells[0].AddParagraph("Internal Car Size:");
            rowdim.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowdim.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowdim.Cells[1].AddParagraph(lVGquote.IntCarSizeWide + " mm W x " + lVGquote.IntCarSizeDeep + " mm D x " + lVGquote.CarHeight + " mm H");
            rowdim.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row rowdim1 = table.AddRow();
            rowdim1.Format.Alignment = ParagraphAlignment.Center;
            if (lVGquote.FrontEntLanDoor == "Swing doors")
            {
                rowdim1.Cells[0].AddParagraph("Shaft Size: ").AddFormattedText("(Alternate door hinging will affect shaft size)", TextFormat.Italic).Size = 9;
            }
            else
            {
                rowdim1.Cells[0].AddParagraph("Shaft Size: "); ;
            }
            //           FormattedText note = new FormattedText("(Alternate door hinging will affect shaft size)");

            rowdim1.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowdim1.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            rowdim1.Cells[1].AddParagraph(lVGquote.ShaftSizeWide + " mm W x " + lVGquote.ShaftSizeDeep + " mm D");
            rowdim1.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row rowdim2 = table.AddRow();
            paragraph = rowdim2.Cells[0].AddParagraph("Door Size:");
            paragraph.AddTab();
            paragraph.AddText("Front Entrance:");
            paragraph.Format.ClearAll();
            paragraph.Format.AddTabStop("8.7cm", TabAlignment.Right);
            rowdim2.Cells[1].AddParagraph(lVGquote.Door1SizeWide + " mm W x " + lVGquote.Doo1SizeDeep + " mm H");
            rowdim2.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            ////            rowdim2.Cells[0].AddParagraph("Front Entrance:");
            ////            rowdim2.Cells[0].Format.Alignment = ParagraphAlignment.Right;
            ////            rowdim2.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;

            //            Row rowdim4 = table.AddRow();
            //            rowdim4.Format.Alignment = ParagraphAlignment.Center;
            //            rowdim4.Cells[0].AddParagraph("Front Entrance:");
            //            rowdim4.Cells[0].Format.Alignment = ParagraphAlignment.Right;
            //            rowdim4.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            //            rowdim4.Cells[1].AddParagraph(lVGquote.Door1SizeWide + " mm W x " + lVGquote.Doo1SizeDeep + " mm H");
            //            rowdim4.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            if (lVGquote.EntranceType != "Front entrance")
            {
                Row rowdim5 = table.AddRow();
                rowdim5.Format.Alignment = ParagraphAlignment.Center;
                rowdim5.Cells[0].AddParagraph("Second Entrance:");
                rowdim5.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                rowdim5.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
                rowdim5.Cells[1].AddParagraph(lVGquote.Door2SizeWide + " mm W x " + lVGquote.Door2SizeDeep + " mm H");
                rowdim5.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            }

            Row rowdim6 = table.AddRow();
            rowdim6.Format.Alignment = ParagraphAlignment.Center;
            paragraph = rowdim6.Cells[0].AddParagraph();
            paragraph.AddText("Headroom ");
            FormattedText formattedText2 = paragraph.AddFormattedText(" (minimum) from finished floor level:", TextFormat.Italic);
            formattedText2.Size = 9;
            rowdim6.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowdim6.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowdim6.Cells[1].AddParagraph(lVGquote.Headroom + " mm");
            rowdim6.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row rowdim7 = table.AddRow();
            rowdim7.Format.Alignment = ParagraphAlignment.Center;
            paragraph = rowdim7.Cells[0].AddParagraph();
            paragraph.AddText("Pit Depth");
            rowdim7.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowdim7.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowdim7.Cells[1].AddParagraph(lVGquote.Pit + " mm");
            rowdim7.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row rowdim8 = table.AddRow();
            rowdim8.Format.Alignment = ParagraphAlignment.Center;
            paragraph = rowdim8.Cells[0].AddParagraph();
            paragraph.AddText("Travel Height");

            FormattedText formattedText = paragraph.AddFormattedText(" ( " + (lVGquote.CodeComplence == "Part 15" ? "4,000" : "12,000") + " mm maximum travel):", TextFormat.Italic);
            formattedText.Size = 9;
            rowdim8.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowdim8.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowdim8.Cells[1].AddParagraph(lVGquote.Travel + " mm");
            rowdim8.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row rowdim10 = table.AddRow();
            rowdim10.Format.Alignment = ParagraphAlignment.Center;
            paragraph = rowdim10.Cells[0].AddParagraph();
            paragraph.AddText("Floor to floor distance");
            FormattedText formattedText6 = paragraph.AddFormattedText(" (From FFL’s)", TextFormat.Italic);
            formattedText6.Size = 9;
            rowdim10.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowdim10.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            rowdim10.Cells[1].AddParagraph("Between floor travel is now confirmed at:");

            for (var i = 0; i < lVGquote.NoOfFloors - 1; i++)
            {

                if (i == 0)
                {
                    rowdim10.Cells[1].AddParagraph(lVGquote.FtoFStart1 + " to " + lVGquote.FtoFFinish1 + "  " + lVGquote.FtoFDistance1 + " mm");

                }
                if (i == 1)
                {
                    rowdim10.Cells[1].AddParagraph(lVGquote.FtoFStart2 + " to " + lVGquote.FtoFFinish2 + "  " + lVGquote.FtoFDistance2 + " mm");

                }
                if (i == 2)
                {
                    rowdim10.Cells[1].AddParagraph(lVGquote.FtoFStart3 + " to " + lVGquote.FtoFFinish3 + "  " + lVGquote.FtoFDistance3 + " mm");

                }
                if (i == 3)
                {
                    rowdim10.Cells[1].AddParagraph(lVGquote.FtoFStart4 + " to " + lVGquote.FtoFFinish4 + "  " + lVGquote.FtoFDistance4 + " mm");

                }

            }
            rowdim10.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            paragraph = section.AddParagraph("");

            if (lVGquote.ExtraNotes != null)
            {
                paragraph = section.AddParagraph("Notes:");  // Link it to the Note section in the form - GAJ TO DO
                paragraph = section.AddParagraph(lVGquote.ExtraNotes);
                paragraph = section.AddParagraph("_________________________________________________________________________________");
                paragraph = section.AddParagraph("_________________________________________________________________________________");
                paragraph = section.AddParagraph("_________________________________________________________________________________");
                paragraph = section.AddParagraph("_________________________________________________________________________________");
                // --------------------------PAGE 4----------------------------------------------------
            }
            else
            {
                paragraph = section.AddParagraph("Notes:");  // Link it to the Note section in the form - GAJ TO DO
                paragraph = section.AddParagraph("_________________________________________________________________________________");
                paragraph = section.AddParagraph("_________________________________________________________________________________");
                paragraph = section.AddParagraph("_________________________________________________________________________________");
                paragraph = section.AddParagraph("_________________________________________________________________________________");
                // --------------------------PAGE 4----------------------------------------------------
            }
            document.LastSection.AddPageBreak();

            paragraph = section.AddParagraph(lVGquote.LiftType + " FINISHES (refer to " + lVGquote.LiftType + " brochure)");
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 13;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;

            paragraph = section.AddParagraph();
            paragraph = section.AddParagraph("CAR FINISHES");
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 13;
            paragraph.Format.SpaceAfter = 5;

            table = section.AddTable();
            table.Style = "Table2";
            table.Borders.Width = 0;
            table.Borders.Left.Width = 0;
            table.Borders.Right.Width = 0;
            table.Rows.LeftIndent = 0;

            Column columncar = table.AddColumn("7cm");
            columncar.Format.Alignment = ParagraphAlignment.Center;

            columncar = table.AddColumn("12cm");
            columncar.Format.Alignment = ParagraphAlignment.Right;

            Row rowcar = table.AddRow();
            rowcar.Format.Alignment = ParagraphAlignment.Center;
            rowcar.Cells[0].AddParagraph("Car Walls:");
            rowcar.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowcar.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowcar.Cells[1].AddParagraph("As viewed from the landing facing your lift car");
            rowcar.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            if (lVGquote.EntranceType == "Front entrance" || lVGquote.EntranceType == "Front & Rear entrance" || lVGquote.EntranceType == "Front & Adjacent – Right")
            {
                Row rowcar1 = table.AddRow();
                rowcar1.Format.Alignment = ParagraphAlignment.Center;
                rowcar1.Cells[0].AddParagraph("Left Hand Side Wall:");
                rowcar1.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                rowcar1.Cells[0].VerticalAlignment = VerticalAlignment.Top;
                rowcar1.Cells[1].AddParagraph(lVGquote.CarWallsLHS);
                rowcar1.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            }
            if (lVGquote.EntranceType == "Front entrance" || lVGquote.EntranceType == "Front & Rear entrance" || lVGquote.EntranceType == "Front & Adjacent – Left")
            {
                Row rowcar3 = table.AddRow();
                rowcar3.Format.Alignment = ParagraphAlignment.Center;
                rowcar3.Cells[0].AddParagraph("Right Hand Side Wall:");
                rowcar3.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                rowcar3.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
                rowcar3.Cells[1].AddParagraph(lVGquote.CarWallsRHS);
                rowcar3.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            }

            if (lVGquote.EntranceType == "Front entrance" || lVGquote.EntranceType == "Front & Adjacent – Left" || lVGquote.EntranceType == "Front & Adjacent – Right")
            {
                Row rowcar33 = table.AddRow();
                rowcar33.Format.Alignment = ParagraphAlignment.Center;
                rowcar33.Cells[0].AddParagraph("Rear Wall:");
                rowcar33.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                rowcar33.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
                rowcar33.Cells[1].AddParagraph(lVGquote.CarWallsRear);
                rowcar33.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            }

            Row rowcar4 = table.AddRow();
            rowcar4.Format.Alignment = ParagraphAlignment.Center;
            rowcar4.Cells[0].AddParagraph("Ceiling");
            rowcar4.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowcar4.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowcar4.Cells[1].AddParagraph(lVGquote.Ceiling);
            rowcar4.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row rowcar5 = table.AddRow();
            rowcar5.Format.Alignment = ParagraphAlignment.Center;
            rowcar5.Cells[0].AddParagraph("Flooring");
            rowcar5.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowcar5.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowcar5.Cells[1].AddParagraph(lVGquote.Floor);
            rowcar5.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row rowcar6 = table.AddRow();
            rowcar6.Format.Alignment = ParagraphAlignment.Center;
            rowcar6.Cells[0].AddParagraph("Profiles");
            rowcar6.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowcar6.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowcar6.Cells[1].AddParagraph(lVGquote.Profile);
            rowcar6.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            //string copLoc = "";
            //if (lVGquote.CopLocLHS == true)
            //{
            //    copLoc = " - Located on: Left Wall";
            //}
            //if (lVGquote.CopLocRHS == true)
            //{
            //    copLoc = " - Located on: Right Wall";
            //}
            //if (lVGquote.CopLocRear == true)
            //{
            //    copLoc = " - Located on: Rear Wall";
            //}

            Row rowcar8 = table.AddRow();
            rowcar8.Format.Alignment = ParagraphAlignment.Center;
            rowcar8.Cells[0].AddParagraph("Control Operating Panel:");
            rowcar8.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowcar8.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            if (lVGquote.Part12 == true)
            {
                rowcar8.Cells[1].AddParagraph("2 X " + lVGquote.CopType + " located on: " + lVGquote.LoadBearingWall + " Wall");
                rowcar8.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            }
            else
            {
                rowcar8.Cells[1].AddParagraph(lVGquote.CopType + " located on: " + lVGquote.LoadBearingWall + " Wall");
                rowcar8.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            }

            Row rowcar10 = table.AddRow();
            rowcar10.Format.Alignment = ParagraphAlignment.Center;
            rowcar10.Cells[0].AddParagraph("Buttons:");
            rowcar10.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowcar10.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            if (lVGquote.CodeComplence == "Part 15")
            {
                rowcar10.Cells[1].AddParagraph(lVGquote.CopButton + " - constant pressure");
                rowcar10.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            }
            else
            {
                rowcar10.Cells[1].AddParagraph(lVGquote.CopButton);
                rowcar10.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            }

            string HandLoc = "";
            if (lVGquote.HandRailLocRHS == true)
            {
                HandLoc = " Located on: Right Wall";
            }
            if (lVGquote.HandRailLocLHS == true)
            {
                HandLoc = " Located on: Left Wall";
            }
            if (lVGquote.HandRailLocRear == true)
            {
                HandLoc = " Located on: Rear Wall";
            }

            Row rowcar21 = table.AddRow();
            rowcar21.Format.Alignment = ParagraphAlignment.Center;
            rowcar21.Cells[0].AddParagraph("Handrail:");
            rowcar21.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowcar21.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            rowcar21.Cells[1].AddParagraph(lVGquote.HandRailType + HandLoc);
            rowcar21.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row rowcar13 = table.AddRow();
            rowcar13.Format.Alignment = ParagraphAlignment.Center;
            rowcar13.Cells[0].AddParagraph("Car Telephone:");
            rowcar13.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowcar13.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowcar13.Cells[1].AddParagraph(lVGquote.Phone + " Located on guide wall side");
            rowcar13.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            if (lVGquote.MirrorType != "No Mirror")
            {
                string MirrorLoc = "";
                if (lVGquote.MirrorLocLHS == true)
                {
                    MirrorLoc = " Located on: Left Wall";
                }
                if (lVGquote.MirrorLocRHS == true)
                {
                    MirrorLoc = " Located on: Right Wall";
                }
                if (lVGquote.MirrorLocRear == true)
                {
                    MirrorLoc = " Located on: Rear Wall";
                }
                Row rowcar12 = table.AddRow();
                rowcar12.Format.Alignment = ParagraphAlignment.Center;
                rowcar12.Cells[0].AddParagraph("Mirror:");
                rowcar12.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                rowcar12.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
                rowcar12.Cells[1].AddParagraph(lVGquote.MirrorType + MirrorLoc);
                rowcar12.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            }
            if (lVGquote.CarDisplayType != "No Display")
            {

                Row rowcar15 = table.AddRow();
                rowcar15.Format.Alignment = ParagraphAlignment.Center;
                rowcar15.Cells[0].AddParagraph("Car Display Type:");
                rowcar15.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                rowcar15.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
                rowcar15.Cells[1].AddParagraph(lVGquote.CarDisplayType);
                rowcar15.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            }
            /*
                        if (lVGquote.CarDisplayTypeLoc != "No Display")
                        {
                            Row rowcar16 = table.AddRow();
                            rowcar16.Format.Alignment = ParagraphAlignment.Center;
                            rowcar16.Cells[0].AddParagraph("Landing Display Type:");
                            rowcar16.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                            rowcar16.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
                            rowcar16.Cells[1].AddParagraph(lVGquote.CarDisplayTypeLoc);
                            if (lVGquote.AllLevels)
                            {
                                Row rowcar16_1 = table.AddRow();
                                rowcar16_1.Format.Alignment = ParagraphAlignment.Center;
                                rowcar16_1.Cells[0].AddParagraph("Landing Display Type:");
                                rowcar16_1.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                                rowcar16_1.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;

                                rowcar16_1.Cells[1].AddParagraph("All Levels");
                            }
                            else
                            {
                                Row rowcar16_1 = table.AddRow();
                                rowcar16_1.Format.Alignment = ParagraphAlignment.Center;
                                rowcar16_1.Cells[0].AddParagraph("Landing Display Type:");
                                rowcar16_1.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                                rowcar16_1.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;

                                if (lVGquote.Level1)
                                { rowcar16_1.Cells[1].AddParagraph("Level 1"); }
                                if (lVGquote.Level2)
                                { rowcar16_1.Cells[1].AddParagraph("Level 2"); }
                                if (lVGquote.Level3)
                                { rowcar16_1.Cells[1].AddParagraph("Level 3"); }
                                if (lVGquote.Level4)
                                { rowcar16_1.Cells[1].AddParagraph("Level 4"); }
                            }

                            rowcar16.Cells[1].Format.Alignment = ParagraphAlignment.Left;
                        }*/

            if (lVGquote.CarDisplayTypeLoc != "No Display")
            {
                Row rowcar16_2 = table.AddRow();
                rowcar16_2.Format.Alignment = ParagraphAlignment.Center;
                rowcar16_2.Cells[0].AddParagraph("Landing Display Type:");
                rowcar16_2.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                rowcar16_2.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
                rowcar16_2.Cells[1].Format.Alignment = ParagraphAlignment.Left;
                rowcar16_2.Cells[1].VerticalAlignment = VerticalAlignment.Bottom;

                string located = "Located on: ";
                if (lVGquote.AllLevels)
                {
                    located += "All Levels";

                }
                else
                {
                    if (lVGquote.Level1)
                    {
                        located += lVGquote.FtoFStart1;
                    }
                    if (lVGquote.Level2)
                    {
                        located += (" & " + lVGquote.FtoFFinish1);

                    }
                    if (lVGquote.Level3)
                    {
                        located += (" & " + lVGquote.FtoFFinish2);
                    }
                    if (lVGquote.Level4)
                    {
                        located += (" & " + lVGquote.FtoFFinish3);
                    }
                    if (lVGquote.Level5)
                    {
                        located += (" & " + lVGquote.FtoFFinish4);
                    }
                }

                rowcar16_2.Cells[1].AddParagraph(lVGquote.CarDisplayTypeLoc + " " + located);
            }
            /*
            Row rowcar16_3 = table.AddRow();
            rowcar16_3.Format.Alignment = ParagraphAlignment.Center;
            rowcar16_3.Cells[0].AddParagraph("Located on:");
            rowcar16_3.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowcar16_3.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowcar16_3.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            rowcar16_3.Cells[1].VerticalAlignment = VerticalAlignment.Bottom;
            if (lVGquote.AllLevels)
            {
                rowcar16_3.Cells[1].AddParagraph("All Levels");

            }
            else
            {
                if (lVGquote.Level1)
                { rowcar16_3.Cells[1].AddParagraph("Level 1"); }
                if (lVGquote.Level2)
                { rowcar16_3.Cells[1].AddParagraph("Level 2"); }
                if (lVGquote.Level3)
                { rowcar16_3.Cells[1].AddParagraph("Level 3"); }
                if (lVGquote.Level4)
                { rowcar16_3.Cells[1].AddParagraph("Level 4"); }
            }

            */

            Row rowcar17 = table.AddRow();
            rowcar17.Format.Alignment = ParagraphAlignment.Center;
            rowcar17.Cells[0].AddParagraph("Car safety protection:");
            rowcar17.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowcar17.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowcar17.Cells[1].AddParagraph(lVGquote.CarSafteyProtection);
            rowcar17.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            if (lVGquote.CarKeySwitch == true &
            lVGquote.LandingKeySwitch == true &
            lVGquote.Gong == true &
            lVGquote.VoiceSynt == true &
            lVGquote.RemoteControl == true &
            lVGquote.ShaftComRalPaint == true &
            lVGquote.MirrorStrip == true &
               lVGquote.NoOfStrips != null)
            {
                Row rowcar19 = table.AddRow();
                rowcar19.Format.Alignment = ParagraphAlignment.Center;
                rowcar19.Cells[0].AddParagraph("Extras Included:");
                rowcar19.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                rowcar19.Cells[0].VerticalAlignment = VerticalAlignment.Top;
                rowcar19.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                if (lVGquote.CarKeySwitch == true)
                {
                    rowcar19.Cells[1].AddParagraph("Car Key Switch");
                }
                if (lVGquote.LandingKeySwitch == true)
                {
                    rowcar19.Cells[1].AddParagraph("Landing Key Switch");
                }
                if (lVGquote.Gong == true)
                {
                    rowcar19.Cells[1].AddParagraph("Gong");
                }
                if (lVGquote.VoiceSynt == true)
                {
                    rowcar19.Cells[1].AddParagraph("Voice Synthesiser");
                }
                if (lVGquote.RemoteControl == true)
                {
                    rowcar19.Cells[1].AddParagraph("Remote Control");
                }
                if (lVGquote.ShaftComRalPaint == true)
                {
                    rowcar19.Cells[1].AddParagraph("Shaft Component RAL Paint");
                    rowcar19.Cells[1].AddParagraph(lVGquote.ShaftComRalPaintText);
                    rowcar19.Cells[1].AddParagraph(lVGquote.ShaftComRalPaintInt.ToString());

                }
                if (lVGquote.MirrorStrip == true)
                {
                    rowcar19.Cells[1].AddParagraph("Mirror st/st Strip ");
                }
                if (lVGquote.NoOfStrips != null)
                {
                    rowcar19.Cells[1].AddParagraph(lVGquote.NoOfStrips.ToString());
                }
            }
            paragraph = section.AddParagraph("");

            paragraph = section.AddParagraph("DOOR FINISHES");
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 13;
            paragraph.Format.SpaceAfter = 5;

            table = section.AddTable();
            table.Style = "Table2";
            table.Borders.Width = 0;
            table.Borders.Left.Width = 0;
            table.Borders.Right.Width = 0;
            table.Rows.LeftIndent = 0;

            Column doorcar = table.AddColumn("7cm");
            doorcar.Format.Alignment = ParagraphAlignment.Center;

            doorcar = table.AddColumn("12cm");
            doorcar.Format.Alignment = ParagraphAlignment.Right;

            Row rowdoor = table.AddRow();
            rowdoor.Format.Alignment = ParagraphAlignment.Center;
            rowdoor.Cells[0].AddParagraph("Door Operation:");
            //rowdoor.Cells[0].Format.Font.size = 11;
            rowdoor.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowdoor.Cells[0].VerticalAlignment = VerticalAlignment.Top;

            if (lVGquote.FrontEntLanDoor == "Swing doors")
            {
                rowdoor.Cells[1].AddParagraph(lVGquote.FrontEntLanDoor);
            }
            else
            {
                rowdoor.Cells[1].AddParagraph("2 Speed automatic side opening");
                Row rowdoor4 = table.AddRow();
                rowdoor4.Format.Alignment = ParagraphAlignment.Center;
                rowdoor4.Cells[0].AddParagraph("Car Door Finish:   \tFront Entrance:");
                rowdoor4.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                rowdoor4.Cells[0].VerticalAlignment = VerticalAlignment.Top;
                rowdoor4.Cells[1].AddParagraph(lVGquote.FrontEntCarDoorFinish);
                rowdoor4.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                if (lVGquote.EntranceType != "Front entrance")
                {
                    if (lVGquote.SecondEntCarDoorFinish != "N/A")
                    {
                        Row rowdoor5 = table.AddRow();
                        rowdoor5.Format.Alignment = ParagraphAlignment.Center;
                        rowdoor5.Cells[0].AddParagraph("Second Entrance:");
                        rowdoor5.Cells[0].Format.Alignment = ParagraphAlignment.Right;
                        rowdoor5.Cells[0].VerticalAlignment = VerticalAlignment.Top;
                        rowdoor5.Cells[1].AddParagraph(lVGquote.SecondEntCarDoorFinish);
                        rowdoor5.Cells[1].Format.Alignment = ParagraphAlignment.Left;
                    }

                }
            }
            rowdoor.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            //Row rowdoor6 = table.AddRow();
            //rowdoor6.Format.Alignment = ParagraphAlignment.Center;
            //rowdoor6.Cells[0].AddParagraph("Landing Operating panel");
            //rowdoor6.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            //rowdoor6.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            //  rowdoor6.Cells[1].Format.Font.size = 11;
            //rowdoor6.Cells[1].AddParagraph(lVGquote.LopFinish1 + "  Location:  " + lVGquote.LopLocation1);
            //rowdoor6.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            // rowdoor6.Cells[1].Format.Font.size = 11;

            //Row rowdoor7 = table.AddRow();
            //rowdoor7.Format.Alignment = ParagraphAlignment.Center;
            //rowdoor7.Cells[0].AddParagraph("Landing Buttons");
            //rowdoor7.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            //rowdoor7.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            //  rowdoor7.Cells[1].Format.Font.size = 11;
            //rowdoor7.Cells[1].AddParagraph(lVGquote.LopButton1);
            //rowdoor7.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            //rowdoor7.Cells[1].Format.Font.size = 11;

            paragraph = section.AddParagraph();
            paragraph = section.AddParagraph("Landing Doors");
            paragraph.Format.Font.Bold = true;
            paragraph.Format.SpaceAfter = 5;

            table = section.AddTable();
            table.Style = "Table3";
            table.Borders.Width = 0.25;
            table.Borders.Color = Colors.Gray;
            table.Borders.Left.Width = 0;
            table.Borders.Right.Width = 0;
            table.Rows.LeftIndent = 0;

            if (lVGquote.FrontEntLanDoor == "Swing doors")
            {

                Column LanDoor = table.AddColumn("1.5cm");
                LanDoor.Format.Alignment = ParagraphAlignment.Center;

                LanDoor = table.AddColumn("2cm");
                LanDoor.Format.Alignment = ParagraphAlignment.Right;

                LanDoor = table.AddColumn("1.5cm");
                LanDoor.Format.Alignment = ParagraphAlignment.Right;
                LanDoor = table.AddColumn("9.5cm");
                LanDoor.Format.Alignment = ParagraphAlignment.Right;
                LanDoor = table.AddColumn("7cm");
                LanDoor.Format.Alignment = ParagraphAlignment.Right;

                Row rowLanDoor = table.AddRow();
                rowLanDoor.Format.Alignment = ParagraphAlignment.Center;
                rowLanDoor.Cells[0].AddParagraph("Levels");
                rowLanDoor.Cells[0].Format.Font.Bold = true;
                rowLanDoor.Cells[0].Format.Font.Size = 9;
                rowLanDoor.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                rowLanDoor.Cells[1].AddParagraph("Entrance Type");
                rowLanDoor.Cells[1].Format.Font.Bold = true;
                rowLanDoor.Cells[1].Format.Font.Size = 9;
                rowLanDoor.Cells[1].Format.Alignment = ParagraphAlignment.Left;
                rowLanDoor.Cells[2].AddParagraph("Door Hinge");
                rowLanDoor.Cells[2].Format.Font.Bold = true;
                rowLanDoor.Cells[2].Format.Font.Size = 9;
                rowLanDoor.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                rowLanDoor.Cells[3].AddParagraph("Door ");
                rowLanDoor.Cells[3].Format.Font.Bold = true;
                rowLanDoor.Cells[3].Format.Font.Size = 9;
                rowLanDoor.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                rowLanDoor.Cells[4].AddParagraph("Landing Operating Panel");
                rowLanDoor.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                rowLanDoor.Cells[4].Format.Font.Bold = true;
                rowLanDoor.Cells[4].Format.Font.Size = 9;

                for (var i = 0; i < lVGquote.NoOfFloors; i++)
                {

                    if (i == 0)
                    {
                        Row rowLanDoor1 = table.AddRow();
                        rowLanDoor1.Format.Alignment = ParagraphAlignment.Center;
                        rowLanDoor1.Cells[0].AddParagraph(lVGquote.FtoFStart1);
                        rowLanDoor1.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                        if (lVGquote.DoorEntType1 == "Second entrance")
                        {
                            rowLanDoor1.Cells[1].AddParagraph("Second");
                        }
                        else { rowLanDoor1.Cells[1].AddParagraph("Front"); }
                        rowLanDoor1.Cells[1].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor1.Cells[1].Format.Font.Size = 9;

                        rowLanDoor1.Cells[2].AddParagraph(lVGquote.Hinge1);
                        rowLanDoor1.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                        rowLanDoor1.Cells[3].AddParagraph("Type: " + lVGquote.LDFDoorType1);
                        rowLanDoor1.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor1.Cells[3].Format.Font.Size = 9;
                        rowLanDoor1.Cells[3].AddParagraph("Finish: " + lVGquote.LDFDoorFinish1);
                        rowLanDoor1.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor1.Cells[3].Format.Font.Size = 9;
                        rowLanDoor1.Cells[3].AddParagraph("Handle: " + lVGquote.LDFDoorHandle1);
                        rowLanDoor1.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor1.Cells[3].Format.Font.Size = 9;

                        rowLanDoor1.Cells[4].AddParagraph("Finish: " + lVGquote.LopFinish1);
                        rowLanDoor1.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor1.Cells[4].Format.Font.Size = 9;
                        rowLanDoor1.Cells[4].AddParagraph("Buttons: " + lVGquote.LopButton1);
                        rowLanDoor1.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor1.Cells[4].Format.Font.Size = 9;
                        rowLanDoor1.Cells[4].AddParagraph("Location: " + lVGquote.LopLocation1);
                        rowLanDoor1.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor1.Cells[4].Format.Font.Size = 9;

                        if (lVGquote.DoorEntType1 == "Front & Second entrance")
                        {
                            rowLanDoor1.Cells[0].MergeDown = 1;

                            Row rowLanDoor2 = table.AddRow();
                            rowLanDoor2.Format.Alignment = ParagraphAlignment.Center;

                            rowLanDoor2.Cells[1].AddParagraph("Second");
                            rowLanDoor2.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                            rowLanDoor2.Cells[2].AddParagraph(lVGquote.Hinge2);
                            rowLanDoor2.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                            //rowLanDoor2.Cells[3].AddParagraph(lVGquote.LDFDoorType2);
                            //rowLanDoor2.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            //rowLanDoor2.Cells[4].AddParagraph(lVGquote.LDFDoorFinish4);
                            //// rowLanDoor2.Cells[4].AddParagraph("LOP" + lVGquote.LopFinish1 + lVGquote.LopLocation1);
                            //rowLanDoor2.Cells[4].Format.Alignment = ParagraphAlignment.Left;

                            rowLanDoor2.Cells[3].AddParagraph("Type: " + lVGquote.LDFDoorType2);
                            rowLanDoor2.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor2.Cells[3].Format.Font.Size = 9;
                            rowLanDoor2.Cells[3].AddParagraph("Finish: " + lVGquote.LDFDoorFinish2);
                            rowLanDoor2.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor2.Cells[3].Format.Font.Size = 9;
                            rowLanDoor2.Cells[3].AddParagraph("Handle: " + lVGquote.LDFDoorHandle2);
                            rowLanDoor2.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor2.Cells[3].Format.Font.Size = 9;

                            rowLanDoor2.Cells[4].AddParagraph("Finish: " + lVGquote.LopFinish2);
                            rowLanDoor2.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor2.Cells[4].Format.Font.Size = 9;
                            rowLanDoor2.Cells[4].AddParagraph("Buttons: " + lVGquote.LopButton2);
                            rowLanDoor2.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor2.Cells[4].Format.Font.Size = 9;
                            rowLanDoor2.Cells[4].AddParagraph("Location: " + lVGquote.LopLocation2);
                            rowLanDoor2.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor2.Cells[4].Format.Font.Size = 9;
                        }
                    }
                    if (i == 1)
                    {
                        Row rowLanDoor3 = table.AddRow();
                        rowLanDoor3.Format.Alignment = ParagraphAlignment.Center;
                        rowLanDoor3.Cells[0].AddParagraph(lVGquote.FtoFStart2); //Link it to the form GAJ TO DO
                        rowLanDoor3.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                        if (lVGquote.DoorEntType3 == "Second entrance")
                        {
                            rowLanDoor3.Cells[1].AddParagraph("Second");
                        }
                        else { rowLanDoor3.Cells[1].AddParagraph("Front"); }
                        rowLanDoor3.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                        rowLanDoor3.Cells[2].AddParagraph(lVGquote.Hinge3);
                        rowLanDoor3.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                        //rowLanDoor3.Cells[3].AddParagraph(lVGquote.LDFDoorType3);
                        //rowLanDoor3.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        //rowLanDoor3.Cells[4].AddParagraph(lVGquote.LDFDoorFinish3);
                        ////rowLanDoor3.Cells[4].AddParagraph("LOP - " + lVGquote.LopFinish2 + lVGquote.LopLocation2);
                        //rowLanDoor3.Cells[4].Format.Alignment = ParagraphAlignment.Left;

                        rowLanDoor3.Cells[3].AddParagraph("Type: " + lVGquote.LDFDoorType3);
                        rowLanDoor3.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor3.Cells[3].Format.Font.Size = 9;
                        rowLanDoor3.Cells[3].AddParagraph("Finish: " + lVGquote.LDFDoorFinish3);
                        rowLanDoor3.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor3.Cells[3].Format.Font.Size = 9;
                        rowLanDoor3.Cells[3].AddParagraph("Handle: " + lVGquote.LDFDoorHandle3);
                        rowLanDoor3.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor3.Cells[3].Format.Font.Size = 9;

                        rowLanDoor3.Cells[4].AddParagraph("Finish: " + lVGquote.LopFinish3);
                        rowLanDoor3.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor3.Cells[4].Format.Font.Size = 9;
                        rowLanDoor3.Cells[4].AddParagraph("Buttons: " + lVGquote.LopButton3);
                        rowLanDoor3.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor3.Cells[4].Format.Font.Size = 9;
                        rowLanDoor3.Cells[4].AddParagraph("Location: " + lVGquote.LopLocation3);
                        rowLanDoor3.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor3.Cells[4].Format.Font.Size = 9;

                        if (lVGquote.DoorEntType3 == "Front & Second entrance")
                        {
                            rowLanDoor3.Cells[0].MergeDown = 1;
                            Row rowLanDoor4 = table.AddRow();
                            rowLanDoor4.Format.Alignment = ParagraphAlignment.Center;

                            rowLanDoor4.Cells[1].AddParagraph("Second");
                            rowLanDoor4.Cells[1].Format.Alignment = ParagraphAlignment.Left;
                            if (lVGquote.FrontEntLanDoor != "Swing doors")
                            {
                                rowLanDoor4.Cells[2].AddParagraph("N/A");
                                rowLanDoor4.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            }
                            else
                            {
                                rowLanDoor4.Cells[2].AddParagraph(lVGquote.Hinge4);
                                rowLanDoor4.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            }
                            //rowLanDoor4.Cells[3].AddParagraph(lVGquote.LDFDoorType4);
                            //rowLanDoor4.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            //rowLanDoor4.Cells[4].AddParagraph(lVGquote.LDFDoorFinish4);
                            //rowLanDoor4.Cells[4].Format.Alignment = ParagraphAlignment.Left;

                            rowLanDoor4.Cells[3].AddParagraph("Type: " + lVGquote.LDFDoorType4);
                            rowLanDoor4.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor4.Cells[3].Format.Font.Size = 9;
                            rowLanDoor4.Cells[3].AddParagraph("Finish: " + lVGquote.LDFDoorFinish4);
                            rowLanDoor4.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor4.Cells[3].Format.Font.Size = 9;
                            rowLanDoor4.Cells[3].AddParagraph("Handle: " + lVGquote.LDFDoorHandle4);
                            rowLanDoor4.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor4.Cells[3].Format.Font.Size = 9;

                            rowLanDoor4.Cells[4].AddParagraph("Finish: " + lVGquote.LopFinish4);
                            rowLanDoor4.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor4.Cells[4].Format.Font.Size = 9;
                            rowLanDoor4.Cells[4].AddParagraph("Buttons: " + lVGquote.LopButton4);
                            rowLanDoor4.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor4.Cells[4].Format.Font.Size = 9;
                            rowLanDoor4.Cells[4].AddParagraph("Location: " + lVGquote.LopLocation4);
                            rowLanDoor4.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor4.Cells[4].Format.Font.Size = 9;
                        }
                    }
                    if (i == 2)
                    {
                        Row rowLanDoor5 = table.AddRow();
                        rowLanDoor5.Format.Alignment = ParagraphAlignment.Center;
                        rowLanDoor5.Cells[0].AddParagraph(lVGquote.FtoFStart3);
                        rowLanDoor5.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                        if (lVGquote.DoorEntType5 == "Second entrance")
                        {
                            rowLanDoor5.Cells[1].AddParagraph("Second");
                        }
                        else { rowLanDoor5.Cells[1].AddParagraph("Front"); }
                        rowLanDoor5.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                        rowLanDoor5.Cells[2].AddParagraph(lVGquote.Hinge5);
                        rowLanDoor5.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                        rowLanDoor5.Cells[3].AddParagraph("Type: " + lVGquote.LDFDoorType5);
                        rowLanDoor5.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor5.Cells[3].Format.Font.Size = 9;
                        rowLanDoor5.Cells[3].AddParagraph("Finish: " + lVGquote.LDFFrameFinish5);
                        rowLanDoor5.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor5.Cells[3].Format.Font.Size = 9;
                        rowLanDoor5.Cells[3].AddParagraph("Handle: " + lVGquote.LDFDoorFinish5);
                        rowLanDoor5.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor5.Cells[3].Format.Font.Size = 9;

                        rowLanDoor5.Cells[4].AddParagraph("Finish: " + lVGquote.LopFinish5);
                        rowLanDoor5.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor5.Cells[4].Format.Font.Size = 9;
                        rowLanDoor5.Cells[4].AddParagraph("Buttons: " + lVGquote.LopButton5);
                        rowLanDoor5.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor5.Cells[4].Format.Font.Size = 9;
                        rowLanDoor5.Cells[4].AddParagraph("Location: " + lVGquote.LopLocation5);
                        rowLanDoor5.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor5.Cells[4].Format.Font.Size = 9;

                        if (lVGquote.DoorEntType5 == "Front & Second entrance")
                        {
                            rowLanDoor5.Cells[0].MergeDown = 1;
                            Row rowLanDoor6 = table.AddRow();
                            rowLanDoor6.Format.Alignment = ParagraphAlignment.Center;

                            rowLanDoor6.Cells[1].AddParagraph("Second");
                            rowLanDoor6.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                            rowLanDoor6.Cells[2].AddParagraph(lVGquote.Hinge6);
                            rowLanDoor6.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                            rowLanDoor6.Cells[3].AddParagraph("Type: " + lVGquote.LDFDoorType6);
                            rowLanDoor6.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor6.Cells[3].Format.Font.Size = 9;
                            rowLanDoor6.Cells[3].AddParagraph("Finish: " + lVGquote.LDFDoorFinish6);
                            rowLanDoor6.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor6.Cells[3].Format.Font.Size = 9;
                            rowLanDoor6.Cells[3].AddParagraph("Handle: " + lVGquote.LDFDoorHandle6);
                            rowLanDoor6.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor6.Cells[3].Format.Font.Size = 9;

                            rowLanDoor6.Cells[4].AddParagraph("Finish: " + lVGquote.LopFinish6);
                            rowLanDoor6.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor6.Cells[4].Format.Font.Size = 9;
                            rowLanDoor6.Cells[4].AddParagraph("Buttons: " + lVGquote.LopButton6);
                            rowLanDoor6.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor6.Cells[4].Format.Font.Size = 9;
                            rowLanDoor6.Cells[4].AddParagraph("Location: " + lVGquote.LopLocation6);
                            rowLanDoor6.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor6.Cells[4].Format.Font.Size = 9;
                        }
                    }
                    if (i == 3)
                    {
                        Row rowLanDoor7 = table.AddRow();
                        rowLanDoor7.Format.Alignment = ParagraphAlignment.Center;
                        rowLanDoor7.Cells[0].AddParagraph(lVGquote.FtoFStart4);
                        rowLanDoor7.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                        if (lVGquote.DoorEntType7 == "Second entrance")
                        {
                            rowLanDoor7.Cells[1].AddParagraph("Second");
                        }
                        else { rowLanDoor7.Cells[1].AddParagraph("Front"); }
                        rowLanDoor7.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                        rowLanDoor7.Cells[2].AddParagraph(lVGquote.Hinge7);
                        rowLanDoor7.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                        rowLanDoor7.Cells[3].AddParagraph("Type: " + lVGquote.LDFDoorType7);
                        rowLanDoor7.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor7.Cells[3].Format.Font.Size = 9;
                        rowLanDoor7.Cells[3].AddParagraph("Finish: " + lVGquote.LDFDoorFinish7);
                        rowLanDoor7.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor7.Cells[3].Format.Font.Size = 9;
                        rowLanDoor7.Cells[3].AddParagraph("Handle: " + lVGquote.LDFDoorHandle7);
                        rowLanDoor7.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor7.Cells[3].Format.Font.Size = 9;

                        rowLanDoor7.Cells[4].AddParagraph("Finish: " + lVGquote.LopFinish7);
                        rowLanDoor7.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor7.Cells[4].Format.Font.Size = 9;
                        rowLanDoor7.Cells[4].AddParagraph("Buttons: " + lVGquote.LopButton7);
                        rowLanDoor7.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor7.Cells[4].Format.Font.Size = 9;
                        rowLanDoor7.Cells[4].AddParagraph("Location: " + lVGquote.LopLocation7);
                        rowLanDoor7.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor7.Cells[4].Format.Font.Size = 9;

                        if (lVGquote.DoorEntType7 == "Front & Second entrance")
                        {
                            rowLanDoor7.Cells[0].MergeDown = 1;
                            Row rowLanDoor8 = table.AddRow();
                            rowLanDoor8.Format.Alignment = ParagraphAlignment.Center;

                            rowLanDoor8.Cells[1].AddParagraph("Second");
                            rowLanDoor8.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                            rowLanDoor8.Cells[2].AddParagraph(lVGquote.Hinge8);
                            rowLanDoor8.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                            rowLanDoor8.Cells[3].AddParagraph("Type: " + lVGquote.LDFDoorType8);
                            rowLanDoor8.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor8.Cells[3].Format.Font.Size = 9;
                            rowLanDoor8.Cells[3].AddParagraph("Finish: " + lVGquote.LDFDoorFinish8);
                            rowLanDoor8.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor8.Cells[3].Format.Font.Size = 9;
                            rowLanDoor8.Cells[3].AddParagraph("Handle: " + lVGquote.LDFDoorHandle8);
                            rowLanDoor8.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor8.Cells[3].Format.Font.Size = 9;

                            rowLanDoor8.Cells[4].AddParagraph("Finish: " + lVGquote.LopFinish8);
                            rowLanDoor8.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor8.Cells[4].Format.Font.Size = 9;
                            rowLanDoor8.Cells[4].AddParagraph("Buttons: " + lVGquote.LopButton8);
                            rowLanDoor8.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor8.Cells[4].Format.Font.Size = 9;
                            rowLanDoor8.Cells[4].AddParagraph("Location: " + lVGquote.LopLocation8);
                            rowLanDoor8.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor8.Cells[4].Format.Font.Size = 9;
                        }
                    }
                    if (i == 4)
                    {
                        Row rowLanDoor9 = table.AddRow();
                        rowLanDoor9.Format.Alignment = ParagraphAlignment.Center;
                        rowLanDoor9.Cells[0].AddParagraph(lVGquote.FtoFFinish4);
                        rowLanDoor9.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                        if (lVGquote.DoorEntType9 == "Second entrance")
                        {
                            rowLanDoor9.Cells[1].AddParagraph("Second");
                        }
                        else { rowLanDoor9.Cells[1].AddParagraph("Front"); }
                        rowLanDoor9.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                        rowLanDoor9.Cells[2].AddParagraph(lVGquote.Hinge9);
                        rowLanDoor9.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                        rowLanDoor9.Cells[3].AddParagraph("Type: " + lVGquote.LDFDoorType9);
                        rowLanDoor9.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor9.Cells[3].Format.Font.Size = 9;
                        rowLanDoor9.Cells[3].AddParagraph("Finish: " + lVGquote.LDFDoorFinish9);
                        rowLanDoor9.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor9.Cells[3].Format.Font.Size = 9;
                        rowLanDoor9.Cells[3].AddParagraph("Handle: " + lVGquote.LDFDoorHandle9);
                        rowLanDoor9.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor9.Cells[3].Format.Font.Size = 9;

                        rowLanDoor9.Cells[4].AddParagraph("Finish: " + lVGquote.LopFinish9);
                        rowLanDoor9.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor9.Cells[4].Format.Font.Size = 9;
                        rowLanDoor9.Cells[4].AddParagraph("Buttons: " + lVGquote.LopButton9);
                        rowLanDoor9.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor9.Cells[4].Format.Font.Size = 9;
                        rowLanDoor9.Cells[4].AddParagraph("Location: " + lVGquote.LopLocation9);
                        rowLanDoor9.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor9.Cells[4].Format.Font.Size = 9;

                        if (lVGquote.DoorEntType9 == "Front & Second entrance")
                        {
                            rowLanDoor9.Cells[0].MergeDown = 1;
                            Row rowLanDoor10 = table.AddRow();
                            rowLanDoor10.Format.Alignment = ParagraphAlignment.Center;

                            rowLanDoor10.Cells[1].AddParagraph("Second");
                            rowLanDoor10.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                            rowLanDoor10.Cells[2].AddParagraph(lVGquote.Hinge10);
                            rowLanDoor10.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                            rowLanDoor10.Cells[3].AddParagraph("Type: " + lVGquote.LDFDoorType10);
                            rowLanDoor10.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor10.Cells[3].Format.Font.Size = 9;
                            rowLanDoor10.Cells[3].AddParagraph("Finish: " + lVGquote.LDFDoorFinish10);
                            rowLanDoor10.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor10.Cells[3].Format.Font.Size = 9;
                            rowLanDoor10.Cells[3].AddParagraph("Handle: " + lVGquote.LDFDoorHandle10);
                            rowLanDoor10.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor10.Cells[3].Format.Font.Size = 9;

                            rowLanDoor10.Cells[4].AddParagraph("Finish: " + lVGquote.LopFinish10);
                            rowLanDoor10.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor10.Cells[4].Format.Font.Size = 9;
                            rowLanDoor10.Cells[4].AddParagraph("Buttons: " + lVGquote.LopButton10);
                            rowLanDoor10.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor10.Cells[4].Format.Font.Size = 9;
                            rowLanDoor10.Cells[4].AddParagraph("Location: " + lVGquote.LopLocation10);
                            rowLanDoor10.Cells[4].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor10.Cells[4].Format.Font.Size = 9;
                        }
                    }
                }

            }
            else
            {
                Column LanDoor = table.AddColumn("1.5cm");
                LanDoor.Format.Alignment = ParagraphAlignment.Center;

                LanDoor = table.AddColumn("2cm");
                LanDoor.Format.Alignment = ParagraphAlignment.Right;

                //LanDoor = table.AddColumn("1.5cm");
                //LanDoor.Format.Alignment = ParagraphAlignment.Right;
                LanDoor = table.AddColumn("8cm");
                LanDoor.Format.Alignment = ParagraphAlignment.Right;
                LanDoor = table.AddColumn("7cm");
                LanDoor.Format.Alignment = ParagraphAlignment.Right;

                Row rowLanDoor = table.AddRow();
                rowLanDoor.Format.Alignment = ParagraphAlignment.Center;
                rowLanDoor.Cells[0].AddParagraph("Levels");
                rowLanDoor.Cells[0].Format.Font.Bold = true;
                rowLanDoor.Cells[0].Format.Font.Size = 9;
                rowLanDoor.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                rowLanDoor.Cells[1].AddParagraph("Entrance Type");
                rowLanDoor.Cells[1].Format.Font.Bold = true;
                rowLanDoor.Cells[1].Format.Font.Size = 9;
                rowLanDoor.Cells[1].Format.Alignment = ParagraphAlignment.Left;
                //rowLanDoor.Cells[2].AddParagraph("Door Hinge");
                //rowLanDoor.Cells[2].Format.Font.Bold = true;
                //rowLanDoor.Cells[2].Format.Font.Size = 9;
                //rowLanDoor.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                rowLanDoor.Cells[2].AddParagraph("Door ");
                rowLanDoor.Cells[2].Format.Font.Bold = true;
                rowLanDoor.Cells[2].Format.Font.Size = 9;
                rowLanDoor.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                rowLanDoor.Cells[3].AddParagraph("Landing Operating Panel");
                rowLanDoor.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                rowLanDoor.Cells[3].Format.Font.Bold = true;
                rowLanDoor.Cells[3].Format.Font.Size = 9;

                for (var i = 0; i < lVGquote.NoOfFloors; i++)
                {

                    if (i == 0)
                    {
                        Row rowLanDoor1 = table.AddRow();
                        rowLanDoor1.Format.Alignment = ParagraphAlignment.Center;
                        rowLanDoor1.Cells[0].AddParagraph(lVGquote.FtoFStart1);  // 1ST LEVEL Link it to the form GAJ TO DO
                        rowLanDoor1.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor1.Cells[1].AddParagraph("front"); // Link it to the form GAJ TO DO
                        rowLanDoor1.Cells[1].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor1.Cells[1].Format.Font.Size = 9;

                        //rowLanDoor1.Cells[2].AddParagraph(lVGquote.Hinge1);
                        //rowLanDoor1.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                        rowLanDoor1.Cells[2].AddParagraph("Type: " + lVGquote.LDFDoorType1);
                        rowLanDoor1.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor1.Cells[2].Format.Font.Size = 9;
                        rowLanDoor1.Cells[2].AddParagraph("Panel: " + lVGquote.LDFDoorFinish1);
                        rowLanDoor1.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor1.Cells[2].Format.Font.Size = 9;
                        rowLanDoor1.Cells[2].AddParagraph("Frame: " + lVGquote.LDFFrameFinish1);
                        rowLanDoor1.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor1.Cells[2].Format.Font.Size = 9;

                        rowLanDoor1.Cells[3].AddParagraph("Finish: " + lVGquote.LopFinish1);
                        rowLanDoor1.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor1.Cells[3].Format.Font.Size = 9;
                        rowLanDoor1.Cells[3].AddParagraph("Buttons: " + lVGquote.LopButton1);
                        rowLanDoor1.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor1.Cells[3].Format.Font.Size = 9;
                        rowLanDoor1.Cells[3].AddParagraph("Location: " + lVGquote.LopLocation1);
                        rowLanDoor1.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor1.Cells[3].Format.Font.Size = 9;

                        if (lVGquote.DoorEntType1 == "Front & Second entrance")
                        {
                            rowLanDoor1.Cells[0].MergeDown = 1;

                            Row rowLanDoor2 = table.AddRow();
                            rowLanDoor2.Format.Alignment = ParagraphAlignment.Center;

                            rowLanDoor2.Cells[1].AddParagraph("Second");
                            rowLanDoor2.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                            //rowLanDoor2.Cells[2].AddParagraph(lVGquote.Hinge2);
                            //rowLanDoor2.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                            //rowLanDoor2.Cells[2].AddParagraph(lVGquote.LDFDoorType2);
                            //rowLanDoor2.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            //rowLanDoor2.Cells[3].AddParagraph(lVGquote.LDFDoorFinish4);
                            //// rowLanDoor2.Cells[3].AddParagraph("LOP" + lVGquote.LopFinish1 + lVGquote.LopLocation1);
                            //rowLanDoor2.Cells[3].Format.Alignment = ParagraphAlignment.Left;

                            rowLanDoor2.Cells[2].AddParagraph("Type: " + lVGquote.LDFDoorType2);
                            rowLanDoor2.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor2.Cells[2].Format.Font.Size = 9;
                            rowLanDoor2.Cells[2].AddParagraph("Panel: " + lVGquote.LDFDoorFinish2);
                            rowLanDoor2.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor2.Cells[2].Format.Font.Size = 9;
                            rowLanDoor2.Cells[2].AddParagraph("Frame: " + lVGquote.LDFFrameFinish2);
                            rowLanDoor2.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor2.Cells[2].Format.Font.Size = 9;

                            rowLanDoor2.Cells[3].AddParagraph("Finish: " + lVGquote.LopFinish2);
                            rowLanDoor2.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor2.Cells[3].Format.Font.Size = 9;
                            rowLanDoor2.Cells[3].AddParagraph("Buttons: " + lVGquote.LopButton2);
                            rowLanDoor2.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor2.Cells[3].Format.Font.Size = 9;
                            rowLanDoor2.Cells[3].AddParagraph("Location: " + lVGquote.LopLocation2);
                            rowLanDoor2.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor2.Cells[3].Format.Font.Size = 9;
                        }
                    }
                    if (i == 1)
                    {
                        Row rowLanDoor3 = table.AddRow();
                        rowLanDoor3.Format.Alignment = ParagraphAlignment.Center;
                        rowLanDoor3.Cells[0].AddParagraph(lVGquote.FtoFStart2); //Link it to the form GAJ TO DO
                        rowLanDoor3.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor3.Cells[1].AddParagraph("front"); //Link it to the form GAJ TO DO
                        rowLanDoor3.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                        //rowLanDoor3.Cells[2].AddParagraph(lVGquote.Hinge3);
                        //rowLanDoor3.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                        //rowLanDoor3.Cells[2].AddParagraph(lVGquote.LDFDoorType3);
                        //rowLanDoor3.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                        //rowLanDoor3.Cells[3].AddParagraph(lVGquote.LDFDoorFinish3);
                        ////rowLanDoor3.Cells[3].AddParagraph("LOP - " + lVGquote.LopFinish2 + lVGquote.LopLocation2);
                        //rowLanDoor3.Cells[3].Format.Alignment = ParagraphAlignment.Left;

                        rowLanDoor3.Cells[2].AddParagraph("Type: " + lVGquote.LDFDoorType3);
                        rowLanDoor3.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor3.Cells[2].Format.Font.Size = 9;
                        rowLanDoor3.Cells[2].AddParagraph("Panel: " + lVGquote.LDFDoorFinish3);
                        rowLanDoor3.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor3.Cells[2].Format.Font.Size = 9;
                        rowLanDoor3.Cells[2].AddParagraph("Frame: " + lVGquote.LDFFrameFinish3);
                        rowLanDoor3.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor3.Cells[2].Format.Font.Size = 9;

                        rowLanDoor3.Cells[3].AddParagraph("Finish: " + lVGquote.LopFinish3);
                        rowLanDoor3.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor3.Cells[3].Format.Font.Size = 9;
                        rowLanDoor3.Cells[3].AddParagraph("Buttons: " + lVGquote.LopButton3);
                        rowLanDoor3.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor3.Cells[3].Format.Font.Size = 9;
                        rowLanDoor3.Cells[3].AddParagraph("Location: " + lVGquote.LopLocation3);
                        rowLanDoor3.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor3.Cells[3].Format.Font.Size = 9;

                        if (lVGquote.DoorEntType3 == "Front & Second entrance")
                        {
                            rowLanDoor3.Cells[0].MergeDown = 1;
                            Row rowLanDoor4 = table.AddRow();
                            rowLanDoor4.Format.Alignment = ParagraphAlignment.Center;

                            rowLanDoor4.Cells[1].AddParagraph("Second");
                            rowLanDoor4.Cells[1].Format.Alignment = ParagraphAlignment.Left;
                            if (lVGquote.FrontEntLanDoor != "Swing doors")
                                //{
                                //    rowLanDoor4.Cells[2].AddParagraph("N/A");
                                //    rowLanDoor4.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                                //}
                                //else
                                //{
                                //    rowLanDoor4.Cells[2].AddParagraph(lVGquote.Hinge4);
                                //    rowLanDoor4.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                                //}
                                //rowLanDoor4.Cells[2].AddParagraph(lVGquote.LDFDoorType4);
                                //rowLanDoor4.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                                //rowLanDoor4.Cells[3].AddParagraph(lVGquote.LDFDoorFinish4);
                                //rowLanDoor4.Cells[3].Format.Alignment = ParagraphAlignment.Left;

                                rowLanDoor4.Cells[2].AddParagraph("Type: " + lVGquote.LDFDoorType4);
                            rowLanDoor4.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor4.Cells[2].Format.Font.Size = 9;
                            rowLanDoor4.Cells[2].AddParagraph("Panel: " + lVGquote.LDFDoorFinish4);
                            rowLanDoor4.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor4.Cells[2].Format.Font.Size = 9;
                            rowLanDoor4.Cells[2].AddParagraph("Frame: " + lVGquote.LDFFrameFinish4);
                            rowLanDoor4.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor4.Cells[2].Format.Font.Size = 9;

                            rowLanDoor4.Cells[3].AddParagraph("Finish: " + lVGquote.LopFinish4);
                            rowLanDoor4.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor4.Cells[3].Format.Font.Size = 9;
                            rowLanDoor4.Cells[3].AddParagraph("Buttons: " + lVGquote.LopButton4);
                            rowLanDoor4.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor4.Cells[3].Format.Font.Size = 9;
                            rowLanDoor4.Cells[3].AddParagraph("Location: " + lVGquote.LopLocation4);
                            rowLanDoor4.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor4.Cells[3].Format.Font.Size = 9;
                        }
                    }
                    if (i == 2)
                    {
                        Row rowLanDoor5 = table.AddRow();
                        rowLanDoor5.Format.Alignment = ParagraphAlignment.Center;
                        rowLanDoor5.Cells[0].AddParagraph(lVGquote.FtoFStart3);
                        rowLanDoor5.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor5.Cells[1].AddParagraph("Front");
                        rowLanDoor5.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                        //rowLanDoor5.Cells[2].AddParagraph(lVGquote.Hinge5);
                        //rowLanDoor5.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                        rowLanDoor5.Cells[2].AddParagraph("Type: " + lVGquote.LDFDoorType5);
                        rowLanDoor5.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor5.Cells[2].Format.Font.Size = 9;
                        rowLanDoor5.Cells[2].AddParagraph("Panel: " + lVGquote.LDFDoorFinish5);
                        rowLanDoor5.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor5.Cells[2].Format.Font.Size = 9;
                        rowLanDoor5.Cells[2].AddParagraph("Frame: " + lVGquote.LDFFrameFinish5);
                        rowLanDoor5.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor5.Cells[2].Format.Font.Size = 9;

                        rowLanDoor5.Cells[3].AddParagraph("Finish: " + lVGquote.LopFinish5);
                        rowLanDoor5.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor5.Cells[3].Format.Font.Size = 9;
                        rowLanDoor5.Cells[3].AddParagraph("Buttons: " + lVGquote.LopButton5);
                        rowLanDoor5.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor5.Cells[3].Format.Font.Size = 9;
                        rowLanDoor5.Cells[3].AddParagraph("Location: " + lVGquote.LopLocation5);
                        rowLanDoor5.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor5.Cells[3].Format.Font.Size = 9;

                        if (lVGquote.DoorEntType5 == "Front & Second entrance")
                        {
                            rowLanDoor5.Cells[0].MergeDown = 1;
                            Row rowLanDoor6 = table.AddRow();
                            rowLanDoor6.Format.Alignment = ParagraphAlignment.Center;

                            rowLanDoor6.Cells[1].AddParagraph("Second");
                            rowLanDoor6.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                            //rowLanDoor6.Cells[2].AddParagraph(lVGquote.Hinge6);
                            //rowLanDoor6.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                            rowLanDoor6.Cells[2].AddParagraph("Type: " + lVGquote.LDFDoorType6);
                            rowLanDoor6.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor6.Cells[2].Format.Font.Size = 9;
                            rowLanDoor6.Cells[2].AddParagraph("Panel: " + lVGquote.LDFDoorFinish6);
                            rowLanDoor6.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor6.Cells[2].Format.Font.Size = 9;
                            rowLanDoor6.Cells[2].AddParagraph("Frame: " + lVGquote.LDFFrameFinish6);
                            rowLanDoor6.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor6.Cells[2].Format.Font.Size = 9;

                            rowLanDoor6.Cells[3].AddParagraph("Finish: " + lVGquote.LopFinish6);
                            rowLanDoor6.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor6.Cells[3].Format.Font.Size = 9;
                            rowLanDoor6.Cells[3].AddParagraph("Buttons: " + lVGquote.LopButton6);
                            rowLanDoor6.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor6.Cells[3].Format.Font.Size = 9;
                            rowLanDoor6.Cells[3].AddParagraph("Location: " + lVGquote.LopLocation6);
                            rowLanDoor6.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor6.Cells[3].Format.Font.Size = 9;
                        }
                    }
                    if (i == 3)
                    {
                        Row rowLanDoor7 = table.AddRow();
                        rowLanDoor7.Format.Alignment = ParagraphAlignment.Center;
                        rowLanDoor7.Cells[0].AddParagraph(lVGquote.FtoFStart4);
                        rowLanDoor7.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor7.Cells[1].AddParagraph("Front");
                        rowLanDoor7.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                        //rowLanDoor7.Cells[2].AddParagraph(lVGquote.Hinge7);
                        //rowLanDoor7.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                        rowLanDoor7.Cells[2].AddParagraph("Type: " + lVGquote.LDFDoorType7);
                        rowLanDoor7.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor7.Cells[2].Format.Font.Size = 9;
                        rowLanDoor7.Cells[2].AddParagraph("Panel: " + lVGquote.LDFDoorFinish7);
                        rowLanDoor7.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor7.Cells[2].Format.Font.Size = 9;
                        rowLanDoor7.Cells[2].AddParagraph("Frame: " + lVGquote.LDFFrameFinish7);
                        rowLanDoor7.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor7.Cells[2].Format.Font.Size = 9;

                        rowLanDoor7.Cells[3].AddParagraph("Finish: " + lVGquote.LopFinish7);
                        rowLanDoor7.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor7.Cells[3].Format.Font.Size = 9;
                        rowLanDoor7.Cells[3].AddParagraph("Buttons: " + lVGquote.LopButton7);
                        rowLanDoor7.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor7.Cells[3].Format.Font.Size = 9;
                        rowLanDoor7.Cells[3].AddParagraph("Location: " + lVGquote.LopLocation7);
                        rowLanDoor7.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor7.Cells[3].Format.Font.Size = 9;

                        if (lVGquote.DoorEntType7 == "Front & Second entrance")
                        {
                            rowLanDoor7.Cells[0].MergeDown = 1;
                            Row rowLanDoor8 = table.AddRow();
                            rowLanDoor8.Format.Alignment = ParagraphAlignment.Center;

                            rowLanDoor8.Cells[1].AddParagraph("Second");
                            rowLanDoor8.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                            //rowLanDoor8.Cells[2].AddParagraph(lVGquote.Hinge8);
                            //rowLanDoor8.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                            rowLanDoor8.Cells[2].AddParagraph("Type: " + lVGquote.LDFDoorType8);
                            rowLanDoor8.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor8.Cells[2].Format.Font.Size = 9;
                            rowLanDoor8.Cells[2].AddParagraph("Panel: " + lVGquote.LDFDoorFinish8);
                            rowLanDoor8.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor8.Cells[2].Format.Font.Size = 9;
                            rowLanDoor8.Cells[2].AddParagraph("Frame: " + lVGquote.LDFFrameFinish8);
                            rowLanDoor8.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor8.Cells[2].Format.Font.Size = 9;

                            rowLanDoor8.Cells[3].AddParagraph("Finish: " + lVGquote.LopFinish8);
                            rowLanDoor8.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor8.Cells[3].Format.Font.Size = 9;
                            rowLanDoor8.Cells[3].AddParagraph("Buttons: " + lVGquote.LopButton8);
                            rowLanDoor8.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor8.Cells[3].Format.Font.Size = 9;
                            rowLanDoor8.Cells[3].AddParagraph("Location: " + lVGquote.LopLocation8);
                            rowLanDoor8.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor8.Cells[3].Format.Font.Size = 9;
                        }
                    }
                    if (i == 4)
                    {
                        Row rowLanDoor9 = table.AddRow();
                        rowLanDoor9.Format.Alignment = ParagraphAlignment.Center;
                        rowLanDoor9.Cells[0].AddParagraph(lVGquote.FtoFFinish4);
                        rowLanDoor9.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor9.Cells[1].AddParagraph("Front");
                        rowLanDoor9.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                        //rowLanDoor9.Cells[2].AddParagraph(lVGquote.Hinge9);
                        //rowLanDoor9.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                        rowLanDoor9.Cells[2].AddParagraph("Type: " + lVGquote.LDFDoorType9);
                        rowLanDoor9.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor9.Cells[2].Format.Font.Size = 9;
                        rowLanDoor9.Cells[2].AddParagraph("Panel: " + lVGquote.LDFDoorFinish9);
                        rowLanDoor9.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor9.Cells[2].Format.Font.Size = 9;
                        rowLanDoor9.Cells[2].AddParagraph("Frame: " + lVGquote.LDFFrameFinish9);
                        rowLanDoor9.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor9.Cells[2].Format.Font.Size = 9;

                        rowLanDoor9.Cells[3].AddParagraph("Finish: " + lVGquote.LopFinish9);
                        rowLanDoor9.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor9.Cells[3].Format.Font.Size = 9;
                        rowLanDoor9.Cells[3].AddParagraph("Buttons: " + lVGquote.LopButton9);
                        rowLanDoor9.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor9.Cells[3].Format.Font.Size = 9;
                        rowLanDoor9.Cells[3].AddParagraph("Location: " + lVGquote.LopLocation9);
                        rowLanDoor9.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                        rowLanDoor9.Cells[3].Format.Font.Size = 9;

                        if (lVGquote.DoorEntType9 == "Front & Second entrance")
                        {
                            rowLanDoor9.Cells[0].MergeDown = 1;
                            Row rowLanDoor10 = table.AddRow();
                            rowLanDoor10.Format.Alignment = ParagraphAlignment.Center;

                            rowLanDoor10.Cells[1].AddParagraph("Second");
                            rowLanDoor10.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                            //rowLanDoor10.Cells[2].AddParagraph(lVGquote.Hinge10);
                            //rowLanDoor10.Cells[2].Format.Alignment = ParagraphAlignment.Left;

                            rowLanDoor10.Cells[2].AddParagraph("Type: " + lVGquote.LDFDoorType10);
                            rowLanDoor10.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor10.Cells[2].Format.Font.Size = 9;
                            rowLanDoor10.Cells[2].AddParagraph("Panel: " + lVGquote.LDFDoorFinish10);
                            rowLanDoor10.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor10.Cells[2].Format.Font.Size = 9;
                            rowLanDoor10.Cells[2].AddParagraph("Frame: " + lVGquote.LDFFrameFinish10);
                            rowLanDoor10.Cells[2].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor10.Cells[2].Format.Font.Size = 9;

                            rowLanDoor10.Cells[3].AddParagraph("Finish: " + lVGquote.LopFinish10);
                            rowLanDoor10.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor10.Cells[3].Format.Font.Size = 9;
                            rowLanDoor10.Cells[3].AddParagraph("Buttons: " + lVGquote.LopButton10);
                            rowLanDoor10.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor10.Cells[3].Format.Font.Size = 9;
                            rowLanDoor10.Cells[3].AddParagraph("Location: " + lVGquote.LopLocation10);
                            rowLanDoor10.Cells[3].Format.Alignment = ParagraphAlignment.Left;
                            rowLanDoor10.Cells[3].Format.Font.Size = 9;
                        }
                    }
                }

            }

            if (lVGquote.ShaftType != "Masonry")
            {

                paragraph = section.AddParagraph();
                paragraph = section.AddParagraph("TOWER FINISH");
                paragraph.Format.Font.Bold = true;
                paragraph.Format.Font.Size = 13;
                paragraph.Format.SpaceAfter = 5;

                table = section.AddTable();
                table.Style = "Table3";

                //          table.Borders.Color = TableBorder;
                table.Borders.Width = 0;
                table.Borders.Left.Width = 0;
                table.Borders.Right.Width = 0;
                table.Rows.LeftIndent = 0;

                Column columnTower = table.AddColumn("7cm");
                columnTower.Format.Alignment = ParagraphAlignment.Center;

                columnTower = table.AddColumn("8cm");
                columnTower.Format.Alignment = ParagraphAlignment.Right;

                Row rowtower = table.AddRow();
                rowtower.Format.Alignment = ParagraphAlignment.Center;
                rowtower.Cells[0].AddParagraph("Application:");
                rowtower.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                rowtower.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
                rowtower.Cells[1].AddParagraph(lVGquote.TowerLocation);
                rowtower.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                if (lVGquote.ShaftType == "Top Hat")
                {
                    Row rowtower1 = table.AddRow();
                    rowtower1.Format.Alignment = ParagraphAlignment.Center;
                    rowtower1.Cells[0].AddParagraph("Structure Type  (this structure is not fire Rated)");
                    rowtower1.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                    rowtower1.Cells[0].VerticalAlignment = VerticalAlignment.Top;
                    rowtower1.Cells[1].AddParagraph(lVGquote.StructureType + "      Partial Structure Height: " + lVGquote.THPartialStructHeight);
                    rowtower1.Cells[1].Format.Alignment = ParagraphAlignment.Left;
                }

                Row rowtower3 = table.AddRow();
                rowtower3.Format.Alignment = ParagraphAlignment.Center;
                rowtower3.Cells[0].AddParagraph("Structure Finish:");
                rowtower3.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                rowtower3.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
                rowtower3.Cells[1].AddParagraph(lVGquote.StructureFinish);
                rowtower3.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                //Row rowtower4 = table.AddRow();
                //rowtower4.Format.Alignment = ParagraphAlignment.Center;
                //rowtower4.Cells[0].AddParagraph("Roof");
                //rowtower4.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                //rowtower4.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
                //rowtower4.Cells[1].AddParagraph(lVGquote.Roof);
                //rowtower4.Cells[1].Format.Alignment = ParagraphAlignment.Left;

                Row rowtower5 = table.AddRow();
                rowtower5.Format.Alignment = ParagraphAlignment.Center;
                rowtower5.Cells[0].AddParagraph("Cladding");
                rowtower5.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                rowtower5.Cells[0].VerticalAlignment = VerticalAlignment.Top;
                rowtower5.Cells[1].AddParagraph("Left Side:  " + lVGquote.CladdingLHS);
                rowtower5.Cells[1].AddParagraph("Right Side: " + lVGquote.CladdingRHS);
                rowtower5.Cells[1].AddParagraph("Rear Side: " + lVGquote.CladdingRear);
                rowtower5.Cells[1].AddParagraph("Front Side: " + lVGquote.CladdingFront);
                rowtower5.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            }
            paragraph = section.AddParagraph("");
            paragraph.Format.SpaceAfter = 5;
            paragraph = section.AddParagraph(lVGquote.Power + " power @ " + lVGquote.Speed + "m/s (maximum) without lift car door");
            paragraph.Format.Font.Bold = true;
            paragraph.Format.SpaceAfter = 5;
            paragraph = section.AddParagraph("");
            paragraph.Format.SpaceAfter = 3;
            paragraph = section.AddParagraph("Lift is required on site approximately  ____/____/_____");
            paragraph.Format.SpaceAfter = 5;

            paragraph.AddLineBreak(); paragraph.AddLineBreak();
            paragraph.AddLineBreak();
            paragraph = section.AddParagraph("Please sign to approve the above finishes:   Signed_______________________ Date: ____/____/________ ");
            paragraph.Format.Font.Bold = true;
            paragraph.AddLineBreak();
            paragraph.AddLineBreak();

            // --------------------------PAGE 5----------------------------------------------------

            document.LastSection.AddPageBreak();
            paragraph = section.AddParagraph("LIFT PRICE");
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 13;

            paragraph = section.AddParagraph("Our price for the supply, installation, testing and commissioning for (" + lVGquote.NoOfLifts + ") Easy Living Home Elevators Italian");
            paragraph = section.AddParagraph("designed, engineered and manufactured " + lVGquote.LiftType + " as described herein is as follows:");

            paragraph = section.AddParagraph();

            table = section.AddTable();
            table.Style = "Table";

            table.Borders.Width = 0;
            table.Borders.Left.Width = 0;
            table.Borders.Right.Width = 0;
            table.Rows.LeftIndent = 0;

            Column price = table.AddColumn("5cm");

            price.Format.Alignment = ParagraphAlignment.Center;

            price = table.AddColumn("5cm");
            price.Format.Alignment = ParagraphAlignment.Right;

            price = table.AddColumn("5cm");
            price.Format.Alignment = ParagraphAlignment.Right;

            Row rowprice = table.AddRow();
            rowprice.Format.Alignment = ParagraphAlignment.Center;
            rowprice.Cells[0].AddParagraph("Price per lift");
            rowprice.Cells[0].Format.Font.Size = 13;
            rowprice.Cells[0].Format.Font.Bold = true;
            rowprice.Cells[0].Format.Alignment = ParagraphAlignment.Left;

            rowprice.Cells[1].AddParagraph("No. of lifts ");
            rowprice.Cells[1].Format.Font.Size = 13;
            rowprice.Cells[1].Format.Font.Bold = true;
            rowprice.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            rowprice.Cells[2].AddParagraph("Total Contract Price ");
            rowprice.Cells[2].Format.Font.Size = 13;
            rowprice.Cells[2].Format.Font.Bold = true;
            rowprice.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            Row rowprice1 = table.AddRow();
            rowprice1.Format.Alignment = ParagraphAlignment.Center;
            string s = string.Format("{0:#,0.00}", Math.Round(float.Parse(lVGquote.SellingPrice), 2));
            rowprice1.Cells[0].AddParagraph("$" + s + " + GST");
            rowprice1.Cells[0].Format.Font.Size = 13;
            rowprice1.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            //twoDec = Math.Round(val, 2)
            rowprice1.Cells[1].AddParagraph("" + lVGquote.NoOfLifts);
            rowprice1.Cells[1].Format.Font.Size = 13;
            rowprice1.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            float s2 = float.Parse(lVGquote.SellingPrice) * lVGquote.NoOfLifts;
            string total_price = string.Format("{0:#,0.00}", Math.Round(s2, 2));
            rowprice1.Cells[2].AddParagraph("$ " + total_price + " + GST");
            rowprice1.Cells[2].Format.Font.Size = 13;
            rowprice1.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            //Row rowprice = table.AddRow();
            //rowprice.Format.Alignment = ParagraphAlignment.Center;
            //rowprice.Cells[0].AddParagraph("Lift Price:");
            //rowprice.Cells[0].Format.Font.Size = 13;
            //rowprice.Cells[0].Format.Font.Bold = true;
            //rowprice.Cells[0].Format.Alignment = ParagraphAlignment.Right;
            //rowprice.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            ////twoDec = Math.Round(val, 2)
            //string s1 = string.Format("{0:#,0.00}", Math.Round(float.Parse(lVGquote.SellingPrice), 2));
            //rowprice.Cells[1].AddParagraph("$ " + s1);
            //rowprice.Cells[1].Format.Font.Size = 13;
            //rowprice.Cells[1].Format.Font.Bold = true;
            //rowprice.Cells[1].Format.Alignment = ParagraphAlignment.Right;

            //Row rowprice1 = table.AddRow();
            //rowprice1.Format.Alignment = ParagraphAlignment.Center;
            //rowprice1.Cells[0].AddParagraph("GST:");
            //rowprice1.Cells[0].Format.Font.Size = 13;
            //rowprice1.Cells[0].Format.Font.Bold = true;
            //rowprice1.Cells[0].Format.Alignment = ParagraphAlignment.Right;
            //rowprice1.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            //string sg = string.Format("{0:#,0.00}", float.Parse(lVGquote.Gst));
            //rowprice1.Cells[1].AddParagraph("$ " + sg);
            //rowprice1.Cells[1].Format.Font.Size = 13;
            //rowprice1.Cells[1].Format.Font.Bold = true;
            //rowprice1.Cells[1].Format.Alignment = ParagraphAlignment.Right;

            //Row rowprice2 = table.AddRow();
            //rowprice2.Format.Alignment = ParagraphAlignment.Center;
            //rowprice2.Cells[0].AddParagraph("Total Lift Price:");
            //rowprice2.Cells[0].Format.Font.Size = 13;
            //rowprice2.Cells[0].Format.Font.Bold = true;
            //rowprice2.Cells[0].Format.Alignment = ParagraphAlignment.Right;
            //rowprice2.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            //string s2 = string.Format("{0:#,0.00}", float.Parse(lVGquote.TotalSellingPrice));
            //rowprice2.Cells[1].AddParagraph("$ " + s2);
            //rowprice2.Cells[1].Format.Font.Size = 13;
            //rowprice2.Cells[1].Format.Font.Bold = true;
            //rowprice2.Cells[1].Format.Alignment = ParagraphAlignment.Right;

            paragraph = section.AddParagraph("");
            paragraph = section.AddParagraph("This is a conditional fixed price based on the above finishes included and is valid for 21 days from today");
            //paragraph.AddLineBreak();

            //paragraph.AddLineBreak();
            if (lVGquote.GstFree)
            {
                Image imagegst = section.AddImage(HttpContext.Current.Server.MapPath("~\\Content\\logo\\GST Free Image.jpg"));
                imagegst.Height = "5cm";
                //imagegst.Width = "14cm";
                imagegst.LockAspectRatio = true;
                imagegst.RelativeVertical = RelativeVertical.Line;
                imagegst.RelativeHorizontal = RelativeHorizontal.Margin;
                //image.Top = ShapePosition.Top;
                imagegst.Left = ShapePosition.Center;
                //  imagegst.WrapFormat.Style = WrapStyle.Through;

            }

            paragraph = section.AddParagraph("");

            table = section.AddTable();
            table.Style = "Table";

            table.Borders.Width = 0;
            table.Borders.Left.Width = 0;
            table.Borders.Right.Width = 0;
            table.Rows.LeftIndent = 0;

            Column waranty = table.AddColumn("5cm");
            waranty.Format.Alignment = ParagraphAlignment.Center;

            waranty = table.AddColumn("5cm");
            waranty.Format.Alignment = ParagraphAlignment.Right;

            Row rowwaranty = table.AddRow();
            rowwaranty.Format.Alignment = ParagraphAlignment.Center;
            rowwaranty.Cells[0].AddParagraph("WARRANTY:");
            rowwaranty.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowwaranty.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowwaranty.Cells[0].Format.Font.Bold = true;
            rowwaranty.Cells[0].Format.Font.Size = 12;
            rowwaranty.Cells[1].AddParagraph(lVGquote.Warranty + " Year(s)");
            rowwaranty.Cells[1].Format.Font.Size = 12;
            rowwaranty.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row rowwaranty1 = table.AddRow();
            rowwaranty1.Format.Alignment = ParagraphAlignment.Center;
            rowwaranty1.Cells[0].AddParagraph("SERVICING:");
            rowwaranty1.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowwaranty1.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            rowwaranty1.Cells[0].Format.Font.Bold = true;
            rowwaranty1.Cells[0].Format.Font.Size = 12;
            rowwaranty1.Cells[1].AddParagraph(lVGquote.Servicing + " Year(s)");
            rowwaranty1.Cells[1].Format.Font.Size = 12;
            rowwaranty1.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            paragraph = section.AddParagraph();

            table = section.AddTable();
            table.Style = "Table2";
            table.Borders.Width = 0;
            table.Borders.Left.Width = 0;
            table.Borders.Right.Width = 0;
            table.Rows.LeftIndent = 0;

            Column prestige = table.AddColumn("6cm");
            prestige.Format.Alignment = ParagraphAlignment.Center;
            prestige = table.AddColumn("10cm");
            prestige.Format.Alignment = ParagraphAlignment.Right;

            Row rowprestige = table.AddRow();
            rowprestige.Format.Alignment = ParagraphAlignment.Center;
            rowprestige.Cells[0].AddParagraph("OPTIONAL EXTRAS");
            rowprestige.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowprestige.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            rowprestige.Cells[0].Format.Font.Bold = true;
            rowprestige.Cells[0].Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;
            rowprestige.Cells[0].Format.Font.Size = 14;

            Row rowprestige1 = table.AddRow();
            rowprestige1.Format.Alignment = ParagraphAlignment.Center;
            rowprestige1.Cells[0].AddParagraph("PRESTIGE FINISHES PACK:");
            rowprestige1.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowprestige1.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            rowprestige1.Cells[0].Format.Font.Bold = true;
            rowprestige1.Cells[0].Format.Font.Size = 12;
            rowprestige1.Cells[1].AddParagraph("1.Mirror Stainless Steel Car Walls");
            rowprestige1.Cells[1].AddParagraph("2.Mirror Stainless Steel Ceiling with LED downlights");
            rowprestige1.Cells[1].AddParagraph("3.Manufactured Stone Floor (Choice of 5 colours)");

            rowprestige1.Cells[1].Format.Alignment = ParagraphAlignment.Left;

            Row rowprestige2 = table.AddRow();
            rowprestige2.Format.Alignment = ParagraphAlignment.Center;
            rowprestige2.Cells[0].AddParagraph("");
            rowprestige2.Cells[1].AddParagraph("Total extra cost $2500 + GST per Lift");
            rowprestige2.Cells[1].Format.Font.Bold = true;
            rowprestige2.Cells[1].Format.Font.Size = 12;

            Row rowprestige3 = table.AddRow();
            rowprestige3.Format.Alignment = ParagraphAlignment.Center;
            rowprestige3.Cells[0].AddParagraph("INSURANCE:");
            rowprestige3.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowprestige3.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            rowprestige3.Cells[0].Format.Font.Bold = true;
            rowprestige3.Cells[0].Format.Font.Size = 12;
            rowprestige3.Cells[1].AddParagraph("Mandatory owner-builder Home Warranty Insurance");
            rowprestige3.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            paragraph.Format.SpaceAfter = 12;

            Row rowprestige4 = table.AddRow();
            rowprestige4.Format.Alignment = ParagraphAlignment.Center;
            rowprestige4.Cells[0].AddParagraph("");
            rowprestige4.Cells[1].AddParagraph("Total extra cost $500 + GST per Lift");
            rowprestige4.Cells[1].Format.Font.Bold = true;
            rowprestige4.Cells[1].Format.Font.Size = 12;

            paragraph.AddLineBreak();
            paragraph.AddLineBreak();
            paragraph = section.AddParagraph("");
            paragraph.Format.SpaceBefore = 12;
            paragraph.AddFormattedText("Please note:", TextFormat.Bold);
            paragraph.AddText("Home Warranty insurance is mandatory for contracts over the value of $12,000, where the contract has been entered into directly between Easy Living Home Elevators and the home owner or owner/builder.  This cost is not included in the tender price and is an additional variation cost if required on this contract");
            paragraph.Format.SpaceAfter = 12;

            paragraph = section.AddParagraph("General");
            paragraph.Format.Font.Bold = true;
            paragraph = section.AddParagraph("The tender is submitted based on our Standard Conditions of Contract. A copy of this document is available on request. We have not included for any architects fees, building application or design application fees, or any building works for the project"
                + "All dimensions to be confirmed via site-specific layout drawing. Drawings to take precedence over any stated dimension. Sketches provided at sales stage are “Not for Construction” This offer takes precedent over any specification document provided for pricing purposes.");
            paragraph.AddLineBreak();
            paragraph.AddFormattedText("Note: Regarding selected RAL paint finishes: ", TextFormat.Bold);
            paragraph.AddText("Every effort will be made to ensure the colours of the lift finish match the colour sample you selected from."
                + "Unfortunately, we cannot guarantee an exact colour match due to differences in substrate material, application thickness and ambient light conditions and as such are not liable for any rectification of same."
                + " The nature of the product means that some slight colour variance may occur.");
            paragraph.Format.SpaceAfter = 12;

            paragraph = section.AddParagraph("The above information describes the Lift Specifications, Lift Finishes, lift price and Warranty & Servicing as per your selection"
                + "and is hereby accepted along with terms of payment & manufacture program as described in the quotation supplied by Easy-Living Home Elevators:");

            paragraph.Format.Font.Bold = true;
            paragraph.Format.SpaceAfter = 25;

            paragraph = section.AddParagraph("Signed:_________________________________________________   Date:_______________");
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph.Format.SpaceAfter = 15;
            paragraph = section.AddParagraph("Print Name_____________________________________________");
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 12;
            paragraph.Format.SpaceAfter = 7;
            document.LastSection.AddPageBreak();

            // --------------------------PAGE 6----------------------------------------------------

            paragraph = section.AddParagraph("PROGRAM AND PAYMENT SCHEDULE");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 14;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;
            paragraph = section.AddParagraph("Easy Living Home Elevators makes the buying program easy! Simply follow the program outlined below."
                + "	Our team of experts will keep you informed on the progress of your elevator, every step of the way.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 10;

            table = section.AddTable();
            table.Style = "Table3";

            table.Borders.Width = 0.5;
            table.Borders.Left.Width = 0.5;
            table.Borders.Right.Width = 0.5;
            table.Rows.LeftIndent = 0.5;

            Column page6 = table.AddColumn("2cm");
            page6.Format.Alignment = ParagraphAlignment.Center;

            page6 = table.AddColumn("14cm");
            page6.Format.Alignment = ParagraphAlignment.Center;

            page6 = table.AddColumn("3.5cm");
            page6.Format.Alignment = ParagraphAlignment.Center;

            Row rowpage6 = table.AddRow();
            rowpage6.Format.Alignment = ParagraphAlignment.Center;
            rowpage6.Cells[0].AddParagraph("LEAD TIME");
            rowpage6.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowpage6.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            rowpage6.Cells[0].Format.Font.Bold = true;
            rowpage6.Cells[0].Format.Font.Size = 10;
            rowpage6.Cells[1].AddParagraph("PROGRAM");
            rowpage6.Cells[1].Format.Font.Bold = true;
            rowpage6.Cells[1].Format.Font.Size = 10;
            rowpage6.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            rowpage6.Cells[2].AddParagraph("PAYMENT");
            rowpage6.Cells[2].Format.Font.Bold = true;
            rowpage6.Cells[2].Format.Font.Size = 10;
            rowpage6.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            Row rowpage61 = table.AddRow();
            rowpage61.Format.Alignment = ParagraphAlignment.Center;
            rowpage61.Cells[0].AddParagraph("Step 1");
            rowpage61.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowpage61.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            rowpage61.Cells[0].Format.Font.Bold = true;
            rowpage61.Cells[0].Format.Font.Size = 11;
            paragraph = rowpage61.Cells[1].AddParagraph();
            paragraph.AddFormattedText("TO PROCESS YOUR ORDER", TextFormat.Bold);
            paragraph.AddText(" without delay we only need four things.");
            rowpage61.Cells[1].AddParagraph("1. Sign acceptance and initial each page of this document.");
            rowpage61.Cells[1].AddParagraph("2. First payment of 10% of the total contract value upon placement of order- To produce site specific Shop Drawings which include preliminary engineering design. Non refundable and is due within 21 days from invoice  issue date");
            rowpage61.Cells[1].AddParagraph("3. Confirmed travel dimension (from bottom finished floor level to top finished floor)");
            rowpage61.Cells[1].AddParagraph("4. Your selection of finishes");
            rowpage61.Cells[1].Format.Font.Size = 10;

            rowpage61.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            paragraph = rowpage61.Cells[2].AddParagraph();
            paragraph.AddFormattedText("Payment:", TextFormat.Bold);
            paragraph.AddText(" First Payment");
            paragraph.AddLineBreak();
            paragraph.AddFormattedText("Amount Payable:", TextFormat.Bold);
            paragraph.AddText(" 10% of the contract value");
            rowpage61.Cells[2].Format.Font.Size = 10;
            rowpage61.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            Row rowpage62 = table.AddRow();
            rowpage62.Format.Alignment = ParagraphAlignment.Center;
            rowpage62.Cells[0].AddParagraph("Step 2");
            rowpage62.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowpage62.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            rowpage62.Cells[0].Format.Font.Bold = true;
            rowpage62.Cells[0].Format.Font.Size = 11;
            paragraph = rowpage62.Cells[1].AddParagraph();
            paragraph.AddFormattedText("SITE SPECIFIC DRAWINGS", TextFormat.Bold);
            paragraph.AddText(" issued for client approval");
            rowpage62.Cells[1].AddParagraph("Please check it carefully paying special attention to the following:");
            rowpage62.Cells[1].AddParagraph("1. Shaft dimensions");
            rowpage62.Cells[1].AddParagraph("2. Travel");
            rowpage62.Cells[1].AddParagraph("3. Pit and headroom");
            rowpage62.Cells[1].AddParagraph("4. It is important that your builder contact us prior to starting construction");
            rowpage62.Cells[1].Format.Font.Size = 10;
            rowpage62.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            rowpage62.Cells[2].AddParagraph("");

            rowpage62.Cells[2].Format.Font.Size = 10;
            rowpage62.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            Row rowpage63 = table.AddRow();
            rowpage63.Format.Alignment = ParagraphAlignment.Center;
            rowpage63.Cells[0].AddParagraph("Step 3");
            rowpage63.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowpage63.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            rowpage63.Cells[0].Format.Font.Bold = true;
            rowpage63.Cells[0].Format.Font.Size = 11;
            paragraph = rowpage63.Cells[1].AddParagraph();
            paragraph.AddFormattedText("TO COMMENCE MANUFACTURE", TextFormat.Bold);
            paragraph.AddText(" of your lift we will require you to send back:");
            rowpage63.Cells[1].AddParagraph("1.Signed and approved copy of the Site Specific drawing");
            rowpage63.Cells[1].AddParagraph("2.Signed and fully completed Finishes and Selections page");
            rowpage63.Cells[1].AddParagraph("3.PC1 payment");
            rowpage63.Cells[1].AddParagraph("4.Outstanding first payment");
            rowpage63.Cells[1].AddParagraph("Date Payable: 90 days after offer acceptance & prior to commencement of manufacture. We reserve the right to adjust the contract price after this 90 day period."
                + "Client/builder is responsible for ensuring the lift is placed into production on time to meet schedule");
            rowpage63.Cells[1].Format.Font.Size = 10;

            rowpage63.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            paragraph = rowpage63.Cells[2].AddParagraph();
            paragraph.AddFormattedText("Payment:", TextFormat.Bold);
            paragraph.AddText(" PC1");
            paragraph.AddLineBreak();
            paragraph.AddFormattedText("Amount Payable:", TextFormat.Bold);
            paragraph.AddText("25%  of the contract value");
            rowpage63.Cells[2].Format.Font.Size = 10;
            rowpage63.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            Row rowpage64 = table.AddRow();
            rowpage64.Format.Alignment = ParagraphAlignment.Center;
            rowpage64.Cells[0].AddParagraph("Week");
            rowpage64.Cells[0].AddParagraph("10-12");
            rowpage64.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowpage64.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            rowpage64.Cells[0].Format.Font.Bold = true;
            rowpage64.Cells[0].Format.Font.Size = 11;
            paragraph = rowpage64.Cells[1].AddParagraph();
            paragraph.AddFormattedText("EX Works**", TextFormat.Bold);
            paragraph.AddLineBreak();
            paragraph.AddFormattedText("To ship your lift", TextFormat.Bold);
            paragraph.AddText(" on the scheduled ex works date we will require you to:");
            rowpage64.Cells[1].AddParagraph("Make payment 2 weeks prior to completion of manufacture of the lift from the factory");
            rowpage64.Cells[1].Format.Font.Size = 10;

            rowpage64.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            paragraph = rowpage64.Cells[2].AddParagraph();
            paragraph.AddFormattedText("Payment:", TextFormat.Bold);
            paragraph.AddText(" PC2");
            paragraph.AddLineBreak();
            paragraph.AddFormattedText("Amount Payable:", TextFormat.Bold);
            paragraph.AddText("35%  of the contract value");
            rowpage64.Cells[2].Format.Font.Size = 10;
            rowpage64.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            Row rowpage65 = table.AddRow();
            rowpage65.Format.Alignment = ParagraphAlignment.Center;
            rowpage65.Cells[0].AddParagraph("Week");
            rowpage65.Cells[0].AddParagraph("16-18");
            rowpage65.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowpage65.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            rowpage65.Cells[0].Format.Font.Bold = true;
            rowpage65.Cells[0].Format.Font.Size = 11;
            paragraph = rowpage65.Cells[1].AddParagraph();
            paragraph.AddFormattedText("Site Delivery***", TextFormat.Bold);
            paragraph.AddLineBreak();
            paragraph.AddFormattedText("To organise site delivery of your lift", TextFormat.Bold);
            paragraph.AddText(" without delay we will require you to:");
            rowpage65.Cells[1].AddParagraph("Make payment, Date Payable: As it clears customs");
            rowpage65.Cells[1].AddParagraph("Site delivery timings are from 8am-5pm Monday to Friday. Surcharge applies for");
            rowpage65.Cells[1].AddParagraph("after hours and weekend deliveries.");
            rowpage65.Cells[1].Format.Font.Size = 10;

            rowpage65.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            paragraph = rowpage65.Cells[2].AddParagraph();
            paragraph.AddFormattedText("Payment:", TextFormat.Bold);
            paragraph.AddText(" PC3");
            paragraph.AddLineBreak();
            paragraph.AddFormattedText("Amount Payable:", TextFormat.Bold);
            paragraph.AddText("10%  of the contract value");
            rowpage65.Cells[2].Format.Font.Size = 10;
            rowpage65.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            Row rowpage66 = table.AddRow();
            rowpage66.Format.Alignment = ParagraphAlignment.Center;
            rowpage66.Cells[0].AddParagraph("Week");
            rowpage66.Cells[0].AddParagraph("18-24");
            rowpage66.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowpage66.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            rowpage66.Cells[0].Format.Font.Bold = true;
            rowpage66.Cells[0].Format.Font.Size = 11;
            paragraph = rowpage66.Cells[1].AddParagraph();
            paragraph.AddFormattedText("Installation", TextFormat.Bold);
            paragraph.AddLineBreak();
            rowpage66.Cells[1].AddParagraph("We require a further 4-7 weeks (depending on the number of stops)");
            rowpage66.Cells[1].AddParagraph("1. Written acceptance of lift is required at completion of lift installation.");
            rowpage66.Cells[1].AddParagraph("2. Final balance is to be paid in progress payments to lift completion and prior to lift being passed into service."
            + " If the lift cannot be passed into service due to outstanding builder’s works, payment of the final contract balance less $500 is required. Final payment of $500 shall be made at handover.");
            rowpage66.Cells[1].Format.Font.Size = 10;
            rowpage66.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            paragraph = rowpage66.Cells[2].AddParagraph();
            paragraph.AddFormattedText("Payment:", TextFormat.Bold);
            paragraph.AddText(" Balance");
            paragraph.AddLineBreak();
            paragraph.AddFormattedText("Amount Payable:", TextFormat.Bold);
            paragraph.AddText("20%  of the contract value");
            rowpage66.Cells[2].Format.Font.Size = 10;
            rowpage66.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            Row rowpage67 = table.AddRow();
            rowpage67.Format.Alignment = ParagraphAlignment.Center;
            rowpage67.Cells[0].AddParagraph("Week");

            rowpage67.Cells[0].AddParagraph("21-24");
            rowpage67.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowpage67.Cells[0].VerticalAlignment = VerticalAlignment.Top;
            rowpage67.Cells[0].Format.Font.Bold = true;
            rowpage67.Cells[0].Format.Font.Size = 11;
            rowpage67.Cells[1].AddParagraph("Completion ");
            rowpage67.Cells[1].Format.Font.Bold = true;

            rowpage67.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            rowpage67.Cells[2].AddParagraph("");

            rowpage67.Cells[2].Format.Font.Size = 11;
            rowpage67.Cells[2].Format.Alignment = ParagraphAlignment.Left;

            Row rowpage68 = table.AddRow();
            rowpage68.Format.Alignment = ParagraphAlignment.Center;
            rowpage68.Cells[0].AddParagraph("  Please note: Time frames exclude Christmas and European August (approx 3 weeks) shutdown periods.");
            rowpage68.Cells[0].MergeRight = 2;

            paragraph = section.AddParagraph("Interest applies on all overdue payments at the applicable cash rate + 3% as published by Westpac Banking Corporation Corporation and any fluctuation in foreign currency that has occurred.");
            paragraph.Format.Font.Size = 9;
            paragraph.Format.Font.Italic = true;
            paragraph.Format.SpaceAfter = 12;

            paragraph = section.AddParagraph("STORAGE");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 14;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;
            paragraph = section.AddParagraph();
            paragraph.AddFormattedText("**Overseas:", TextFormat.Bold);
            paragraph.AddText("Should your project or payments be delayed, transport and storage costs for completed equipment required to be stored at the overseas factory are payable at a rate of $250+GST per lift, per week.");
            paragraph.Format.Font.Size = 10;
            paragraph.AddLineBreak();
            paragraph = section.AddParagraph();
            paragraph.AddFormattedText("***Local:", TextFormat.Bold);
            paragraph.AddText(" If you cannot accept delivery of the lift equipment on site when it clears customs, we must arrange storage and insurance on your behalf for an additional $250+GST per lift, per week. Space is limited and is not always available. An additional delivery charge also applies because we have delivered your equipment twice (Once to the storage facility and once to site) this extra charge is $995.00+GST per lift, for capital city metropolitan areas and TBA for any other regional location.");
            paragraph.Format.Font.Size = 10;
            document.LastSection.AddPageBreak();

            // --------------------------PAGE 7----------------------------------------------------

            paragraph = section.AddParagraph("Dear Customer, please take a few moments to complete the form below");
            paragraph = section.AddParagraph();

            paragraph = section.AddParagraph("Quote Number: " + " " + "P" + model.id + "-" + lVGquote.id);
            paragraph.Format.Font.Bold = true;
            paragraph = section.AddParagraph();
            paragraph.AddText("Project Name: " + model.ProjectName);
            paragraph.Format.SpaceAfter = 12;
            paragraph.Format.Font.Bold = true;
            paragraph = section.AddParagraph("FULL DETAILS OF CUSTOMER");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 14;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;

            paragraph = section.AddParagraph();
            table = section.AddTable();
            table.Style = "Table2";
            // table.Borders.Width = 0.75;
            //table.Borders.Left.Width = 0;
            //table.Borders.Right.Width = 0;
            //table.Borders.Top.Width = 0;
            //table.Rows.LeftIndent = 0;

            Column columnCustomerDetail = table.AddColumn("7cm");
            columnCustomerDetail.Format.Alignment = ParagraphAlignment.Center;

            columnCustomerDetail = table.AddColumn("13cm");
            columnCustomerDetail.Format.Alignment = ParagraphAlignment.Left;
            columnCustomerDetail.Borders.Width = 0.75;
            columnCustomerDetail.Borders.Left.Width = 0;
            columnCustomerDetail.Borders.Right.Width = 0;
            columnCustomerDetail.Borders.Top.Width = 0;

            Row rowCustomerDetail = table.AddRow();
            rowCustomerDetail.Format.Alignment = ParagraphAlignment.Center;
            rowCustomerDetail.Cells[0].AddParagraph("Contact Name:");
            rowCustomerDetail.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowCustomerDetail.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowCustomerDetail.Cells[1].AddParagraph("" + (model.ContactName == null ? "" : model.ContactName));
            rowCustomerDetail.Cells[1].Borders.Color = Colors.Black;
            rowCustomerDetail.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowCustomerDetail1 = table.AddRow();
            rowCustomerDetail1.Format.Alignment = ParagraphAlignment.Center;
            rowCustomerDetail1.Cells[0].AddParagraph("Registered Name of Company:");
            rowCustomerDetail1.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowCustomerDetail1.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowCustomerDetail1.Cells[1].AddParagraph("");
            rowCustomerDetail1.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowCustomerDetail2 = table.AddRow();
            rowCustomerDetail2.Format.Alignment = ParagraphAlignment.Center;
            rowCustomerDetail2.Cells[0].AddParagraph("Trading Name:");
            rowCustomerDetail2.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowCustomerDetail2.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowCustomerDetail2.Cells[1].AddParagraph("" + (model.Company == null ? "" : model.Company));
            rowCustomerDetail2.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowCustomerDetail3 = table.AddRow();
            rowCustomerDetail3.Format.Alignment = ParagraphAlignment.Center;
            rowCustomerDetail3.Cells[0].AddParagraph("Address:");
            rowCustomerDetail3.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowCustomerDetail3.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowCustomerDetail3.Cells[1].AddParagraph("");
            rowCustomerDetail3.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowCustomerDetail4 = table.AddRow();
            rowCustomerDetail4.Format.Alignment = ParagraphAlignment.Center;
            rowCustomerDetail4.Cells[0].AddParagraph("Mobile Number:");
            rowCustomerDetail4.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowCustomerDetail4.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowCustomerDetail4.Cells[1].AddParagraph("");
            rowCustomerDetail4.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowCustomerDetail5 = table.AddRow();
            rowCustomerDetail5.Format.Alignment = ParagraphAlignment.Center;
            rowCustomerDetail5.Cells[0].AddParagraph("Phone Number:");
            rowCustomerDetail5.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowCustomerDetail5.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowCustomerDetail5.Cells[1].AddParagraph("" + (model.Phone == null ? "" : model.Phone));
            rowCustomerDetail5.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowCustomerDetail6 = table.AddRow();
            rowCustomerDetail6.Format.Alignment = ParagraphAlignment.Center;
            rowCustomerDetail6.Cells[0].AddParagraph("Fax Number:");
            rowCustomerDetail6.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowCustomerDetail6.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowCustomerDetail6.Cells[1].AddParagraph("");
            rowCustomerDetail6.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowCustomerDetail7 = table.AddRow();
            rowCustomerDetail7.Format.Alignment = ParagraphAlignment.Center;
            rowCustomerDetail7.Cells[0].AddParagraph("Email Address for Invoices/Statements:");
            rowCustomerDetail7.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowCustomerDetail7.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowCustomerDetail7.Cells[1].AddParagraph("" + (model.Email == null ? "" : model.Email));
            rowCustomerDetail7.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowCustomerDetail8 = table.AddRow();
            rowCustomerDetail8.Format.Alignment = ParagraphAlignment.Center;
            rowCustomerDetail8.Cells[0].AddParagraph("Contact Name for Accounts:");
            rowCustomerDetail8.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowCustomerDetail8.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowCustomerDetail8.Cells[1].AddParagraph("");
            rowCustomerDetail8.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            paragraph = section.AddParagraph();
            paragraph = section.AddParagraph("PROJECT SITE RELATED DETAILS");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 14;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;

            table = section.AddTable();
            table.Style = "Table2";

            Column columnSiteDetail = table.AddColumn("7cm");
            columnSiteDetail.Format.Alignment = ParagraphAlignment.Center;

            columnSiteDetail = table.AddColumn("13cm");
            columnSiteDetail.Format.Alignment = ParagraphAlignment.Left;
            columnSiteDetail.Borders.Width = 0.75;
            columnSiteDetail.Borders.Left.Width = 0;
            columnSiteDetail.Borders.Right.Width = 0;
            columnSiteDetail.Borders.Top.Width = 0;

            Row rowSiteDetail = table.AddRow();
            rowSiteDetail.Format.Alignment = ParagraphAlignment.Center;
            rowSiteDetail.Cells[0].AddParagraph("Site Contact Name:");
            rowSiteDetail.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowSiteDetail.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowSiteDetail.Cells[1].AddParagraph("");
            rowSiteDetail.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowSiteDetail1 = table.AddRow();
            rowSiteDetail1.Format.Alignment = ParagraphAlignment.Center;
            rowSiteDetail1.Cells[0].AddParagraph("Job Title:");
            rowSiteDetail1.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowSiteDetail1.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowSiteDetail1.Cells[1].AddParagraph("");
            rowSiteDetail1.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowSiteDetail2 = table.AddRow();
            rowSiteDetail2.Format.Alignment = ParagraphAlignment.Center;
            rowSiteDetail2.Cells[0].AddParagraph("Company Name:");
            rowSiteDetail2.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowSiteDetail2.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowSiteDetail2.Cells[1].AddParagraph("");
            rowSiteDetail2.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowSiteDetail4 = table.AddRow();
            rowSiteDetail4.Format.Alignment = ParagraphAlignment.Center;
            rowSiteDetail4.Cells[0].AddParagraph("Mobile Number:");
            rowSiteDetail4.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowSiteDetail4.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowSiteDetail4.Cells[1].AddParagraph("");
            rowSiteDetail4.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowSiteDetail5 = table.AddRow();
            rowSiteDetail5.Format.Alignment = ParagraphAlignment.Center;
            rowSiteDetail5.Cells[0].AddParagraph("Phone Number:");
            rowSiteDetail5.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowSiteDetail5.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowSiteDetail5.Cells[1].AddParagraph("");
            rowSiteDetail5.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowSiteDetail6 = table.AddRow();
            rowSiteDetail6.Format.Alignment = ParagraphAlignment.Center;
            rowSiteDetail6.Cells[0].AddParagraph("Fax Number:");
            rowSiteDetail6.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowSiteDetail6.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowSiteDetail6.Cells[1].AddParagraph("");
            rowSiteDetail6.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowSiteDetail7 = table.AddRow();
            rowSiteDetail7.Format.Alignment = ParagraphAlignment.Center;
            rowSiteDetail7.Cells[0].AddParagraph("Email Address:");
            rowSiteDetail7.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowSiteDetail7.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowSiteDetail7.Cells[1].AddParagraph("");
            rowSiteDetail7.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            paragraph = section.AddParagraph();
            paragraph = section.AddParagraph("OTHER CONTACTS");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 14;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;
            paragraph = section.AddParagraph("CONTACT 1");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;

            table = section.AddTable();
            table.Style = "Table2";

            Column columnOtherDetail = table.AddColumn("7cm");
            columnOtherDetail.Format.Alignment = ParagraphAlignment.Center;

            columnOtherDetail = table.AddColumn("13cm");
            columnOtherDetail.Format.Alignment = ParagraphAlignment.Left;
            columnOtherDetail.Borders.Width = 0.75;
            columnOtherDetail.Borders.Left.Width = 0;
            columnOtherDetail.Borders.Right.Width = 0;
            columnOtherDetail.Borders.Top.Width = 0;

            Row rowOtherDetail = table.AddRow();
            rowOtherDetail.Format.Alignment = ParagraphAlignment.Center;
            rowOtherDetail.Cells[0].AddParagraph("Contact Name:");
            rowOtherDetail.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowOtherDetail.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowOtherDetail.Cells[1].AddParagraph("");
            rowOtherDetail.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowOtherDetail1 = table.AddRow();
            rowOtherDetail1.Format.Alignment = ParagraphAlignment.Center;
            rowOtherDetail1.Cells[0].AddParagraph("Job Title:");
            rowOtherDetail1.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowOtherDetail1.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowOtherDetail1.Cells[1].AddParagraph("");
            rowOtherDetail1.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowOtherDetail2 = table.AddRow();
            rowOtherDetail2.Format.Alignment = ParagraphAlignment.Center;
            rowOtherDetail2.Cells[0].AddParagraph("Company Name:");
            rowOtherDetail2.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowOtherDetail2.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowOtherDetail2.Cells[1].AddParagraph("");
            rowOtherDetail2.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowOtherDetail4 = table.AddRow();
            rowOtherDetail4.Format.Alignment = ParagraphAlignment.Center;
            rowOtherDetail4.Cells[0].AddParagraph("Mobile Number:");
            rowOtherDetail4.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowOtherDetail4.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowOtherDetail4.Cells[1].AddParagraph("");
            rowOtherDetail4.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowOtherDetail5 = table.AddRow();
            rowOtherDetail5.Format.Alignment = ParagraphAlignment.Center;
            rowOtherDetail5.Cells[0].AddParagraph("Phone Number:");
            rowOtherDetail5.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowOtherDetail5.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowOtherDetail5.Cells[1].AddParagraph("");
            rowOtherDetail5.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowOtherDetail7 = table.AddRow();
            rowOtherDetail7.Format.Alignment = ParagraphAlignment.Center;
            rowOtherDetail7.Cells[0].AddParagraph("Email Address:");
            rowOtherDetail7.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowOtherDetail7.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowOtherDetail7.Cells[1].AddParagraph("");
            rowOtherDetail7.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            paragraph = section.AddParagraph();
            paragraph = section.AddParagraph("CONTACT 2");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;

            table = section.AddTable();
            table.Style = "Table2";

            Column columnContactDetail = table.AddColumn("7cm");
            columnContactDetail.Format.Alignment = ParagraphAlignment.Center;

            columnContactDetail = table.AddColumn("13cm");
            columnContactDetail.Format.Alignment = ParagraphAlignment.Left;
            columnContactDetail.Borders.Width = 0.75;
            columnContactDetail.Borders.Left.Width = 0;
            columnContactDetail.Borders.Right.Width = 0;
            columnContactDetail.Borders.Top.Width = 0;

            Row rowContactDetail = table.AddRow();
            rowContactDetail.Format.Alignment = ParagraphAlignment.Center;
            rowContactDetail.Cells[0].AddParagraph("Contact Name:");
            rowContactDetail.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowContactDetail.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowContactDetail.Cells[1].AddParagraph("");
            rowContactDetail.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowContactDetail1 = table.AddRow();
            rowContactDetail1.Format.Alignment = ParagraphAlignment.Center;
            rowContactDetail1.Cells[0].AddParagraph("Job Title:");
            rowContactDetail1.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowContactDetail1.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowContactDetail1.Cells[1].AddParagraph("");
            rowContactDetail1.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowContactDetail2 = table.AddRow();
            rowContactDetail2.Format.Alignment = ParagraphAlignment.Center;
            rowContactDetail2.Cells[0].AddParagraph("Company Name:");
            rowContactDetail2.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowContactDetail2.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowContactDetail2.Cells[1].AddParagraph("");
            rowContactDetail2.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowContactDetail4 = table.AddRow();
            rowContactDetail4.Format.Alignment = ParagraphAlignment.Center;
            rowContactDetail4.Cells[0].AddParagraph("Mobile Number:");
            rowContactDetail4.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowContactDetail4.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowContactDetail4.Cells[1].AddParagraph("");
            rowContactDetail4.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowContactDetail5 = table.AddRow();
            rowContactDetail5.Format.Alignment = ParagraphAlignment.Center;
            rowContactDetail5.Cells[0].AddParagraph("Phone Number:");
            rowContactDetail5.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowContactDetail5.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowContactDetail5.Cells[1].AddParagraph("");
            rowContactDetail5.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            Row rowContactDetail7 = table.AddRow();
            rowContactDetail7.Format.Alignment = ParagraphAlignment.Center;
            rowContactDetail7.Cells[0].AddParagraph("Email Address:");
            rowContactDetail7.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            rowContactDetail7.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
            rowContactDetail7.Cells[1].AddParagraph("");
            rowContactDetail7.Cells[1].Format.Alignment = ParagraphAlignment.Justify;

            // --------------------------PAGE 8 -  WORKS BY OTHERS  ----------------------------------------------------

            document.LastSection.AddPageBreak();
            Image image4 = section.AddImage(HttpContext.Current.Server.MapPath("~\\Content\\logo\\WBO Tick box.jpg"));
            image4.Height = "3.5cm";
            //image2.Width = "1cm";
            image4.LockAspectRatio = true;
            image4.RelativeVertical = RelativeVertical.Line;
            image4.RelativeHorizontal = RelativeHorizontal.Margin;
            image4.Left = ShapePosition.Right;
            image4.WrapFormat.Style = WrapStyle.Through;
            paragraph = section.AddParagraph("WORKS BY OTHERS CHECKLIST");
            paragraph.Format.Font.Name = "Tahoma";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 16;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;
            paragraph.Format.Alignment = ParagraphAlignment.Justify;
            paragraph = section.AddParagraph("THE FOLLOWING ITEMS ARE YOUR RESPONSIBILTY");
            paragraph.Format.Font.Name = "Tahoma";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 16;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;
            paragraph.Format.Alignment = ParagraphAlignment.Justify;
            paragraph.Format.SpaceAfter = 12;
            paragraph = section.AddParagraph("What you have to do for us to make your Project a success.....");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 14;
            paragraph.Format.Alignment = ParagraphAlignment.Left;
            paragraph.Format.SpaceAfter = 12;

            paragraph = section.AddParagraph("1. APPROVED DRAWING");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 14;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;
            paragraph = section.AddParagraph("1.1 Build to your Approved Drawing only");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Do not build to the “Not for Construction” drawing provided at sales stage, or any preliminary dimensions shown in brochures, architectural details etc."); // 2.4 Lift Type
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("1.2 All vertical dimensions on our drawings are from Finished Floor Level (FFL)");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Are critical and those noted on the site specific drawing must be adhered to. Ensure any rough opening heights are calculated from FFL. A typical construction problem occurs if rough openings are measured from the SFL and not considering floor finishes in measurement calculations.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph.AddLineBreak();
            paragraph.AddFormattedText(lVGquote.LiftType + " (masonary shaft) Vertical Travel:", TextFormat.Bold); // Dimension is critical to +/- 25mm changes as per lift type KAREN
            paragraph.AddText("Dimension is critical to +/- 25mm");
            paragraph.AddLineBreak();
            paragraph.AddFormattedText(lVGquote.LiftType + " (Shaft Structure) Vertical Travel:", TextFormat.Bold); // Dimension is critical to +/- 25mm changes as per lift type KAREN
            paragraph.AddText("Dimension is critical to +/- 4mm");
            //paragraph = section.AddParagraph("1.3 If you make a mistake or change anything:");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Bold = true;
            //paragraph.Format.Font.Size = 12;
            //paragraph = section.AddParagraph("If you change anything, the drawing will need to be re-issued and additional costs will apply both in re-drawing and equipment costs. Your project will also be delayed. If you realise you have made a mistake and not built to the approved drawing, stop immediately and get clarification.");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Size = 11;
            //paragraph.Format.LeftIndent = "0.6cm";
            paragraph.Format.SpaceAfter = 12;

            //paragraph = section.AddParagraph("2. PAYMENTS");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Bold = true;
            //paragraph.Format.Font.Size = 14;
            //paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;
            //paragraph = section.AddParagraph("2.1 Pay your site delivery payment on time");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Bold = true;
            //paragraph.Format.Font.Size = 12;
            //paragraph = section.AddParagraph("We will not deliver without receipt of your site delivery payment.");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Size = 11;
            //paragraph.Format.LeftIndent = "0.6cm";
            //paragraph = section.AddParagraph("2.2 Pay your final payment upon our completion");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Bold = true;
            //paragraph.Format.Font.Size = 12;
            //paragraph = section.AddParagraph("If the lift cannot be passed into service due to outstanding builder’s works, payment of the final contract balance less $500 is required. Final payment of $500 shall be made at handover.");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Size = 11;
            //paragraph.Format.LeftIndent = "0.6cm";
            //paragraph = section.AddParagraph("2.3 Paying on time avoids price rises");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Bold = true;
            //paragraph.Format.Font.Size = 12;
            //paragraph = section.AddParagraph("Our fixed price is based on the program and payments provided in our quotation. If you do not pay on time we will charge penalty interest on late payments and any fluctuation in foreign currency that has occurred.");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Size = 11;
            //paragraph.Format.LeftIndent = "0.6cm";
            //paragraph.Format.SpaceAfter = 12;

            //paragraph = section.AddParagraph("3. MANUFACTURE");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Bold = true;
            //paragraph.Format.Font.Size = 14;
            //paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;
            //paragraph = section.AddParagraph("3.1 Placement of elevator into production/manufacture");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Bold = true;
            //paragraph.Format.Font.Size = 12;
            //paragraph = section.AddParagraph("Client/builder is responsible for ensuring the lift is placed into production on time to meet their schedule.");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Size = 11;
            //paragraph.Format.LeftIndent = "0.6cm";
            //paragraph.Format.SpaceAfter = 12;

            paragraph = section.AddParagraph("2. DELIVERY & STORAGE");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 14;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;
            paragraph = section.AddParagraph("2.1 Site access and OHS");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Provide appropriate site access in full compliance with current Occupational Health and Safety requirements. " +
                "Clear level access for delivery by tailgate loader or crane truck must be provided with access into the storage area by pallet jack. " +
                "Extra cost will be incurred for non-standard delivery.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            //paragraph = section.AddParagraph("4.2 Site access and OHS");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Bold = true;
            //paragraph.Format.Font.Size = 12;
            //paragraph = section.AddParagraph("Provide appropriate site access in full compliance with current Occupational Health and Safety requirements. " +
            //                     " Clear level access for delivery by tailgate loader or crane truck must be provided with access into the storage area by pallet jack. Extra cost will be incurred for non-standard delivery.");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Size = 11;
            //paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("2.2 Hoisting Facilities");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("If delivery is difficult, we may need assistance from a crane or all terrain forklift to be provided by client. At no cost to ELHE.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 10.5;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("2.3 Site Storage Area");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Provide dry, clean and safe storage of the lift equipment on site. The location of the storage area shall be agreed with ELHE and be close to the lift shaft and machine room. The storage area required is equivalent to approximately one car space per lift + tower boxes if applicable.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("2.4 Insurance");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Client/Builder is responsible for lift equipment & insurance once delivered to site.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph.Format.SpaceAfter = 12;
            //document.LastSection.AddPageBreak();

            paragraph = section.AddParagraph("3. LIFT SHAFT");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 14;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;
            paragraph = section.AddParagraph("3.1 Build the shaft plumb, flush & square");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("To your approved drawings. It is reasonable for ELHE (Easy Living Home Elevators) to claim additional cost for works required due to incorrect building works.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("3.2 Weather Proofing");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("We require the shaft, all landing entrances and the controller location to be weather proof prior to our commencement. The controller is not provided with a waterproof enclosure. The workspace in front of the controller is also required to be covered and sheltered from the weather.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("3.3 Scaffolding");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Lift shaft scaffolding to internal and/or external of lift shaft or tower to be supplied with SWL of 250kg at each floor served. At no cost to ELHE. Position to be confirmed by ELHE representative");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("3.4 Load bearing wall(s)");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Must be either poured concrete, OR pre-cast concrete OR core filled reinforced block OR steel columns as designed by a structural engineer. ");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph.AddLineBreak();
            paragraph = section.AddParagraph("Cavity brick walls are not suitable. Loads are shown on our layout drawing.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("3.5 Non load bearing walls");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Can be timber or metal stud construction provided this method is engineer approved. You must provide a smooth finish internally with plasterboard or 6mm Villaboard.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("3.6 Steel Column Supports Instead of Block/Masonry");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Must be approved by your engineer, including the fixing points at pit, floors and headroom. Columns supplied by others and installed inside wall cavity. (Sample engineering steel design from ELHE upon request)");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("3.7 Glass installed in the Lift Shaft");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Must be 10.76 laminated and fitted flush with the inside face of the lift shaft. To comply with AS1735 (not AS1288)");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            document.LastSection.AddPageBreak();
            paragraph = section.AddParagraph("3.8 Lift Pit");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Must be kept dry. No seepage or damp areas are allowed. This is a safety requirement and will affect the long-term condition of the equipment. No drainage is required in the pit. If a drain is present, it must have a non-return valve fitted. If a pit is not provided the builder must provide a ramp. Ramp must comply with BCA access requirements.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("3.9 Shaft & Pit Finish");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("A smooth and plumb surface shall be provided. Ensure shaft and pit is dry, stripped, cleaned, holes patched and free of construction debris and formwork nails or other protrusions prior to our start on site. Note pit dimensions is from FFL.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("3.10 Shaft Roof");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Must be a solid, non-perforated material, permanently fixed from the inside of the shaft and of sufficient strength to support the weight of a person, nominally 120kg. The lift shaft must not open into a roof space or, for flat roofs; removal of a roofing sheet shall not expose the open top of a lift shaft and therefore a fall risk for the person working on the roof. ");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("3.11 Shaft Protection Barricades");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("must be supplied, installed and maintained to each lift entrance or penetrations through floors. Cages are required for commercial jobs.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph.Format.SpaceAfter = 12;

            paragraph = section.AddParagraph("4. ELECTRICAL REQUIREMENTS");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 14;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;
            paragraph = section.AddParagraph("4.1 Core Holes");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("We require core holes in positions indicated by your ELHE Representative. Typically this core hole is 100mm diameter. Patching and/making good to this core hole is by the builder if required. ");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            //paragraph.Format.SpaceAfter = 12;
            //paragraph.AddFormattedText(lVGquote.LiftType, TextFormat.Bold);
            //paragraph.AddText(": The location of this core hole shall be 315mm from FFL to the RHS of the " + lVGquote.LiftType + " control cabinet."); // THis will change as per lift type KAREN
            //document.LastSection.AddPageBreak();
            paragraph = section.AddParagraph("4.2 Other services in the Lift shaft");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Other services are not permitted in the lift shaft.(Examples: storm water pipes, cable TV, security wiring) ");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";

            paragraph = section.AddParagraph("4.3 Conduits");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Any conduits intended to carry lift cabling or hydraulic hoses from controller cabinet to lift shaft must be 100mm diameter minimum and include sweep bends (3 x 30 degree or 2 x 45 degree) not 90 degree elbows.");// 100mm diameter to be changed as per lift type
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph.AddLineBreak();
            paragraph.AddFormattedText("For Conduits coming up into the slab:", TextFormat.Bold);
            paragraph.AddText("Note preferred locations and exclusion zone in diagram below.");
            //paragraph.Format.SpaceAfter = "6cm";
            Image image5 = section.AddImage(HttpContext.Current.Server.MapPath("~\\Content\\logo\\WBO diagram.jpg"));
            image5.Height = "6cm";
            //image2.Width = "1cm";
            image5.LockAspectRatio = true;
            image5.RelativeVertical = RelativeVertical.Line;
            image5.RelativeHorizontal = RelativeHorizontal.Margin;
            image5.Left = ShapePosition.Center;
            //image5.WrapFormat.Style = WrapStyle.Through;
            paragraph = section.AddParagraph("4.4 Power Requirements" + lVGquote.LiftType);
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("We require permanent single phase power rated at " + lVGquote.Power + " for the " + lVGquote.LiftType + "left to lock off isolator at the controller location.  Power must be active for installation of lift.");//Change Lift type & amps
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("4.5 Lighting");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("There must be lighting to the area that contains the controller cabinet.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("4.6 Phone Point & Eagle Controller (if applicable):");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Provide single separate  telephone point and/or ethernet plug for remote diagnostics and monitoring (Eagle Controller only) within 250mm of the location of the lift controller drive cabinet."
            + "It may be an extension to the main house line in single private residences only. In all other applications a separate dedicated phone line must be provided."
             + "All connection charges and line rental is by the builder/owner, these are not included by ELHE");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            //paragraph = section.AddParagraph("6.7 Eagle Controller (if applicable)");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Bold = true;
            //paragraph.Format.Font.Size = 12;
            //paragraph = section.AddParagraph("Provide ethernet plug for remote diagnostics and monitoring within 250mm of the location of the lift controller drive cabinet. It may be an extension to the main house line in single private residences only."
            //    + "n all other applications a separate dedicated line must be provided. All usage and connection charges is by the builder/owner, these are not included by ELHE.");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Size = 11;
            //paragraph.Format.LeftIndent = "0.6cm";
            //paragraph.AddLineBreak();
            //paragraph.AddFormattedText("WiFi Connection:", TextFormat.Bold);
            //paragraph.AddText("Is required for onsite testing and using the iphone application as a remote control for the lift.");
            paragraph = section.AddParagraph("4.7 Fire Rating");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Fire rated lift sub-mains are required for all installations other than a private home");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph.Format.SpaceAfter = 12;

            paragraph = section.AddParagraph("5. LIFT BUTTONS & DOORS");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 14;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;
            paragraph = section.AddParagraph("5.1 Landing Buttons");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Are typically located within the frame but if installed onto a wall, the landing button finishing is by builder.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            document.LastSection.AddPageBreak();
            paragraph = section.AddParagraph("5.2 Making Good");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Building in and/or making good to lift doorframes, penetrations and floor sills. Finishing of nibs back to door frame by builder after door installation.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("5.3 Glass Door");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("For clear or tinted glass landing doors, the inside of the shaft is visible when the lift is away from that floor & requires finishing (paint, render, bagging etc)");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph.AddFormattedText("Note:", TextFormat.Bold | TextFormat.Italic);
            paragraph.AddFormattedText("Overall shaft size must be maintained.", TextFormat.Italic);
            paragraph = section.AddParagraph("5.4 Door Opening Sides");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Lift shaft to be smooth & finished on door opening side(s) to within 3mm.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("5.5 Doors Exposed To Weather");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Landing doors are not and cannot be made waterproof. An awning and protection against wind driven rain is required where the lift doors are located in the open.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph.Format.SpaceAfter = 12;

            paragraph = section.AddParagraph("6. CONTROL CABINET");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 14;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;
            paragraph = section.AddParagraph("6.1 Location of control cabinet:");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("At lowest floor. The control and pump system can be located at alternate floor to that noted above however further calculations are required; please consult ELHE. Locked, finish painted cabinet (in cream colour) is supplied by ELHE. Cabinet is not fire rated or weather proof.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph.AddFormattedText("Note:", TextFormat.Bold | TextFormat.Italic);
            paragraph.AddFormattedText("Cabinet is not fire rated.", TextFormat.Italic);
            paragraph = section.AddParagraph("6.2 Machine Room Requirements (commercial/public access applications only)");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("If machine room is provided, supply and install fire door with closer and night-type latch to the lift machine room entrance. Minimum door dimension is 900mm x 2000mm clear. The door must open outwards from the lift machine room.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("6.3 Control Cabinet Access");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Clear permanent access of 600mm wide X 2000mm high must be provided in front of the lift control cabinet.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph.Format.SpaceAfter = 12;

            //document.LastSection.AddPageBreak();
            paragraph = section.AddParagraph("7. GENERAL");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 14;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;
            paragraph = section.AddParagraph("7.1 Lift Car Flooring");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Where lift car flooring is not provided by ELHE, you must provide a 6mm aluminium plate floor for ELHE to fit prior to installation of floor finish. Dimensions to be provided by ELHE.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("7.2 Owner Supplied Flooring");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Maximum thickness is 15mm including fixing medium.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("7.3 Safety Requirements");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Parts of the lift equipment move when operating and must be painted yellow. These are visible through glass doors or glass tower structure panels; they cannot be painted another colour.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("7.4 Timing");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph(" Your lift contains sophisticated electronic computer equipment as well as other systems sensitive to atmospheric dust and moisture. The lift should be installed as late as practicable in the construction program to ensure a reliable finished product. A “rule of thumb” is that commencement of the lift installation should coincide with commencement of the interior painting contractor.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("7.5 Use as a Builders Lift/Hoist");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Use as a builders lift or hoist is not recommended and voids any warranty for parts and labour.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("7.6 Access Key Safe");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Builder to provide suitable location, we will supply and install a key safe, to permit 24 hour access in the event of lift fault. Final location to be confirmed by us.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("7.7 Signage");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("We would like to erect an advertising sign on site");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("7.8 Rubbish removal ");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Your purchase price includes packaging. This means it is yours to dispose of. We are happy to dispose of the lift packaging into your site bins. Rubbish removal from the site is the responsibility of the client/builder");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("7.9 Acceptance of finishes through sign-off");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("We require the lift doors and cabin finishes to be accepted via sign-off after installation – not at the end of the project. If inspection of lift finishes check list is not signed off then client /builder accepts the finishes.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("7.10 Installation start date");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Pre-installation checklists are required to be completed once lift shaft associated works are complete. Once all items are finalised and checked an installation start date is scheduled and typically is between 3 and 6 weeks after receipt of this paperwork.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph.Format.SpaceAfter = 12;

            document.LastSection.AddPageBreak();
            paragraph = section.AddParagraph("8. WORKS TO ADD FOR TOWER STRUCTURES & TOP HATS");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 14;
            paragraph.Format.Font.Color = MigraDoc.DocumentObjectModel.Colors.YellowGreen;
            paragraph = section.AddParagraph("8.1 Tower Structure");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("A suitable lift base and finish to floor penetrations must be provided prior to ELHE commencing on site. You will need to finish the lift tower prior to our completion. The tower structure is of standard design and is suitable to support the lift only and cannot be used as a structural member for the surrounding building."
                + "clear or tinted glass in the tower means that all workings of the lift are visible. In some cases of extended travel and/or limited fixing points, use of a steel tower may be required, POA");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("8.2 Fixings");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Fixings are required in the pit, each landing entrance and at the top of the shaft tower. At the top of the tower, suitable points must be provided to fix to. These points need to be allowed for in the building design (Max span 3.5m)");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("8.3 Cross Bracing");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("For indoor tower structures internal “cross” bracing may be required. For outside tower structures internal “diagonal cross” bracing for wind resistance will be required. This is provided by ELHE and subject to factory engineering conditions.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("8.4 Fixed Against Wall");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("The wall must be plumb to +/-10mm in total, subject to a site visit and measure.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            //paragraph = section.AddParagraph("8.5 Tolerance ");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Bold = true;
            //paragraph.Format.Font.Size = 12;
            //paragraph = section.AddParagraph("Tolerance of vertical floor to floor heights is +/-4mm from FFL.");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Size = 11;
            //paragraph.Format.LeftIndent = "0.6cm";
            paragraph = section.AddParagraph("8.5 Through A Floor");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("Where the tower structure runs through a floor, we require: 35mm clearance on each side and a maximum of 10mm on the door side.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            //paragraph.AddLineBreak();
            //paragraph.AddFormattedText("Single Entry Towers:", TextFormat.Bold);
            //paragraph.AddText("35mm clearance on each side and a maximum of 10mm on the door side.");
            //paragraph.AddLineBreak();
            //paragraph.AddFormattedText("Adjacent or Through Entry Towers:", TextFormat.Bold);
            //paragraph.AddText("35mm clearance on each side and a maximum of 10mm on the door side.");
            paragraph = section.AddParagraph("8.6 Exposed To Weather");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph = section.AddParagraph("The lift tower and landing doors are weather resistant and not waterproof. Where the tower structure is exposed to weather, an awning should be fitted over the tower and landing the entrances. This is to protect the landing doors from weather. It is the client/builders responsibility to seal around the shaft and pit.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Size = 11;
            paragraph.Format.LeftIndent = "0.6cm";
            //paragraph = section.AddParagraph("10.8 Overhead Ceiling ");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Bold = true;
            //paragraph.Format.Font.Size = 12;
            //paragraph = section.AddParagraph("Where there is an overhead ceiling, a recess of 130mm high x the width of the tower + 70mm x depth of the tower + 70mm is required. This recess must have a top of sufficient strength to support 120kg and can support the top of the tower loads.");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Size = 11;
            //paragraph.Format.LeftIndent = "0.6cm";
            //paragraph = section.AddParagraph("10.9 Scaffolding");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Bold = true;
            //paragraph.Format.Font.Size = 12;
            //paragraph = section.AddParagraph("Lift shaft scaffolding for tower structures is required to be provided to both internal and external of lift tower at no cost to ELHE. This is to be supplied by the builder with SWL of 250kg at each floor served and to ELHE specifications.");
            //paragraph.Format.Font.Name = "Calibri";
            //paragraph.Format.Font.Size = 11;
            //paragraph.Format.LeftIndent = "0.6cm";
            paragraph.Format.SpaceAfter = 12;

            paragraph = section.AddParagraph("Please contact your local Project Management office for any information you need about getting your lift shaft construction right. We have experienced lift technicians on hand to answer your questions.");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Italic = true;
            paragraph.Format.Font.Size = 12;
            paragraph.Format.SpaceAfter = 12;
            paragraph.AddLineBreak();
            paragraph = section.AddParagraph("");

            paragraph.AddFormattedText("The above is hereby understood and accepted:", TextFormat.Bold);
            paragraph = section.AddParagraph("");
            paragraph.Format.SpaceAfter = 12;

            paragraph = section.AddParagraph("Signed:_________________________________________________   Date:_______________");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph.Format.SpaceAfter = 15;
            paragraph = section.AddParagraph("Print Name_____________________________________________");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph.Format.SpaceAfter = 15;
            paragraph = section.AddParagraph("For and on behalf of (company)__________________________________________________");
            paragraph.Format.Font.Name = "Calibri";
            paragraph.Format.Font.Bold = true;
            paragraph.Format.Font.Size = 12;
            paragraph.Format.SpaceAfter = 15;

            //paragraph = section.AddParagraph("Door Operation:"); //2.6
            //paragraph.Format.Font.Bold = true;
            //paragraph.Format.Font.Size = 11;
            //paragraph.Format.SpaceAfter = 2;
            //paragraph = section.AddParagraph(" Car Door Finish"); // 2.7
            //paragraph.Format.Font.Bold = true;
            //paragraph.Format.Font.Size = 11;
            //paragraph.Format.SpaceAfter = 2;
            //paragraph = section.AddParagraph("Front Entrance"); // 4.8
            //paragraph.Format.Font.Size = 11;
            //paragraph.Format.SpaceAfter = 2;
            //paragraph = section.AddParagraph("Rear/Adj Entrance"); // 4.8
            //paragraph.Format.Font.Size = 11;
            //paragraph.Format.SpaceAfter = 2;

            //paragraph = section.AddParagraph("Landing Doors :"); // 2.1
            //paragraph.Format.Font.Bold = true;
            //paragraph.Format.Font.Size = 12;
            //paragraph.Format.Font.Italic = true;
            //paragraph.Format.SpaceAfter = 3;
        }
Beispiel #30
0
        private void GenerateSeatingPDF(string file)
        {
            StreamReader File = new StreamReader(file);
            Document document = new Document();
            document.Info.Title = "Seating Arrangement";
            document.Info.Subject = "Seating Arrangement";
            document.Info.Author = "BPHC-Instruction Division";
            getStyles(document);

            Section section = document.AddSection();
            section.PageSetup.Orientation = MigraDoc.DocumentObjectModel.Orientation.Portrait;
            section.PageSetup.TopMargin = Unit.FromCentimeter(4.0);
            section.PageSetup.BottomMargin = Unit.FromCentimeter(1);
            HeaderFooter header = section.Headers.Primary;
            MigraDoc.DocumentObjectModel.Shapes.Image image = header.AddImage(txtImageFile.Text);
            image.Width = Unit.FromCentimeter(15);
            Table table = new Table();
            Column column = table.AddColumn(Unit.FromCentimeter(2.3)); 
            table.AddColumn(Unit.FromCentimeter(2.4)).Format.Alignment = ParagraphAlignment.Center;
            table.AddColumn(Unit.FromCentimeter(2.4)).Format.Alignment = ParagraphAlignment.Center;
            table.AddColumn(Unit.FromCentimeter(1.3)).Format.Alignment = ParagraphAlignment.Center;
            table.AddColumn(Unit.FromCentimeter(2)).Format.Alignment = ParagraphAlignment.Center;
            table.AddColumn(Unit.FromCentimeter(3)).Format.Alignment = ParagraphAlignment.Center;
            table.AddColumn(Unit.FromCentimeter(3)).Format.Alignment = ParagraphAlignment.Center;
            table.Borders.Width = 0.75;
            Row row = table.AddRow();row.HeadingFormat = true;
            row.Shading.Color = MigraDoc.DocumentObjectModel.Colors.PaleGoldenrod;
            Cell cell = row.Cells[0];
            cell.AddParagraph("COURSE CODE");
            cell = row.Cells[1];
            cell.AddParagraph("DATE");
            cell = row.Cells[2];
            cell.AddParagraph("TIME");
            cell = row.Cells[3];
            cell.AddParagraph("ROOM NO");
            cell = row.Cells[4];
            cell.AddParagraph("STRENGTH");
            cell = row.Cells[5];
            cell.AddParagraph("IDs FROM");
            cell = row.Cells[6];
            cell.AddParagraph("IDs TO");
            string line = "";
            File.ReadLine();
            while ((line = File.ReadLine()) != null)
            {
                string[] ar1 = line.Split(',');
                if (line.StartsWith(",,,"))
                {
                    row = table.AddRow();
                    cell = row.Cells[3];
                    cell.AddParagraph(ar1[3]);
                    cell = row.Cells[4];
                    cell.AddParagraph(ar1[4]);
                    cell = row.Cells[5];
                    cell.AddParagraph(ar1[5]);
                    cell = row.Cells[6];
                    cell.AddParagraph(ar1[6]);
                }
                else if (ar1.Length == 7)
                {
                    row = table.AddRow(); 
                    cell = row.Cells[0];
                    cell.AddParagraph(ar1[0]);
                    cell = row.Cells[1];
                    cell.AddParagraph((ar1[1]+", "+ar1[2]).Replace("\"",""));
                    cell = row.Cells[2];
                    cell.AddParagraph(ar1[3]);
                    cell = row.Cells[3];
                    cell.AddParagraph(ar1[4]);
                    cell = row.Cells[4];
                    cell.AddParagraph(ar1[5]);
                    cell = row.Cells[5];
                    cell.AddParagraph(ar1[6]);
                    cell.MergeRight = 1;
                }
                else if (ar1.Length == 8)
                {
                    row = table.AddRow(); 
                    cell = row.Cells[0];
                    cell.AddParagraph(ar1[0]);
                    cell = row.Cells[1];
                    cell.AddParagraph((ar1[1] + ", " + ar1[2]).Replace("\"", ""));
                    cell = row.Cells[2];
                    cell.AddParagraph(ar1[3]);
                    cell = row.Cells[3];
                    cell.AddParagraph(ar1[4]);
                    cell = row.Cells[4];
                    cell.AddParagraph(ar1[5]);
                    cell = row.Cells[5];
                    cell.AddParagraph(ar1[6]);
                    cell = row.Cells[6];
                    cell.AddParagraph(ar1[7]);
                }
            }
            section.Add(table);
            MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToFile(document, "MigraDoc.mdddl");
            PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always);
            renderer.Document = document;
            renderer.RenderDocument();
            // Save the document...
            string filename = WorkingFolder + "/SEATING ARRANGEMENT.pdf";
            renderer.PdfDocument.Save(filename);
            Process.Start(filename);
            txtStatus.Text = "Student Seating Arrangement: " + file + Environment.NewLine + "Student Seating Arrangement: " + WorkingFolder + "/SEATING ARRANGEMENT.pdf";

        }
Beispiel #31
0
        private MigraDoc.DocumentObjectModel.Tables.Table AddTable(IPdfStyling pdfStyling, Section section)
        {
            // This is a little bit faky, otherwise we can't add spaces before and after table
            if (this._spaceBefore > 0 || this._spaceAfter > 0)
            {
                IPdfElement pdfSpace = new PdfSpace(this._spaceBefore, this._spaceAfter);
                pdfSpace.Render(pdfStyling: pdfStyling, section: section);
            }

            // Add table to the section
            MigraDoc.DocumentObjectModel.Tables.Table table = section.AddTable();

            // This is a little bit faky, otherwise we can't add spaces before and after table
            if (this._spaceBefore > 0 || this._spaceAfter > 0)
            {
                IPdfElement pdfSpace = new PdfSpace(this._spaceBefore, this._spaceAfter);
                pdfSpace.Render(pdfStyling: pdfStyling, section: section);
            }

            //THead (and Columns)

            // Calculate widths if necessary
            double[] widths = TableExtensions.CalculateColumnWidths(
                pdfStyling: pdfStyling,
                document: section.Document,
                tHead: this.THead,
                tBody: this.TBody,
                fitToDocument: _fitToDocument);

            // Create columns from THead
            Column column;

            for (int c = 0; c < this.THead.Count; c++)
            {
                column = table.AddColumn(new Unit(widths[c]));
                column.Format.Alignment = this.THead[c].Alignment.GetAlignment();
            }

            // Create the header of the table
            Row thead;

            if (this.THead.Any(o => string.IsNullOrWhiteSpace(o.Text.Trim())) == false)
            {
                //HINT: If an error appears here because you did not added PdfTableHeaderCells -> you have to add but with empty strings :-)
                thead            = table.AddRow();
                thead.TopPadding = Unit.FromPoint(5);
                //titleRow.BottomPadding = Unit.FromPoint(5);
                thead.HeadingFormat = true;

                for (int i = 0; i < this.THead.Count; i++)
                {
                    AddText(
                        pdfStyling: pdfStyling,
                        pdfCell: this.THead[i],
                        cell: thead.Cells[i]);

                    thead.Cells[i].VerticalAlignment = VerticalAlignment.Top;
                    thead.Cells[i].Style             = PdfStyleNames.Table.THead;
                }
            }

            //TBody

            for (int i = 0; i < this.TBody.Count; i++)
            {
                AddCell(
                    pdfStyling: pdfStyling,
                    table: table,
                    pdfRow: this.TBody[i],
                    isTFoot: false);
            }

            //TFoot

            for (int i = 0; i < this.TFoot.Count; i++)
            {
                AddCell(
                    pdfStyling: pdfStyling,
                    table: table,
                    pdfRow: this.TFoot[i],
                    isTFoot: true);
            }

            return(table);
        }
    private void generatePDFFile()
    {
        // Create a MigraDoc document
        Document doc = new Document();

        doc.Info.Title   = "Work Order";
        doc.Info.Subject = "Order No:" + oModOrder.GetSetorderno;
        doc.Info.Author  = "B.I.O.App System";

        //set page orientation
        doc.DefaultPageSetup.Orientation    = MigraDoc.DocumentObjectModel.Orientation.Portrait;
        doc.DefaultPageSetup.TopMargin      = "7.5cm"; //120
        doc.DefaultPageSetup.BottomMargin   = "8.5cm"; //150
        doc.DefaultPageSetup.LeftMargin     = 40;
        doc.DefaultPageSetup.RightMargin    = 40;
        doc.DefaultPageSetup.HeaderDistance = "1.5cm"; //20
        doc.DefaultPageSetup.FooterDistance = "1cm";   //20

        MigraDoc.DocumentObjectModel.Style style = doc.Styles["Normal"];
        // Because all styles are derived from Normal, the next line changes the
        // font of the whole document. Or, more exactly, it changes the font of
        // all styles and paragraphs that do not redefine the font.
        style.Font.Name = "Verdana";

        // Create a new style called Table based on style Normal
        style           = doc.Styles.AddStyle("Table", "Normal");
        style.Font.Name = "Verdana";
        style.Font.Name = "Arial";
        style.Font.Size = 8;

        // Each MigraDoc document needs at least one section.
        Section section = doc.AddSection();

        // Put Capital Digital logo in the header
        string logo_lima = Server.MapPath("~/images/logo_CD_bgBLUE_BLACK_310x98.png");

        MigraDoc.DocumentObjectModel.Shapes.Image image = section.Headers.Primary.AddImage(logo_lima);
        image.Height             = "1cm";
        image.LockAspectRatio    = true;
        image.RelativeVertical   = RelativeVertical.Line;
        image.RelativeHorizontal = RelativeHorizontal.Margin;
        image.Top              = ShapePosition.Top;
        image.Left             = ShapePosition.Right;
        image.WrapFormat.Style = WrapStyle.Through;

        // Put CD logo in the header
        string logo_mod = Server.MapPath("~/images/logo_versi_4.png");

        MigraDoc.DocumentObjectModel.Shapes.Image image2 = section.Headers.Primary.AddImage(logo_mod);
        image2.Height             = "1.5cm";
        image2.LockAspectRatio    = true;
        image2.RelativeVertical   = RelativeVertical.Line;
        image2.RelativeHorizontal = RelativeHorizontal.Margin;
        image2.Top              = ShapePosition.Top;
        image2.Left             = ShapePosition.Left;
        image2.WrapFormat.Style = WrapStyle.Through;

        // Create Header
        Paragraph header = section.Headers.Primary.AddParagraph();

        header.AddText("WORK ORDER FORM");
        header.Format.Font.Size = 12;
        header.Format.Font.Bold = true;
        header.Format.Alignment = ParagraphAlignment.Center;

        // Create main section for Sales Order
        //Paragraph main = section.AddParagraph();
        // main = section.AddParagraph();
        //main.Format.SpaceBefore = 1;

        // Create the item table for header
        //MigraDoc.DocumentObjectModel.Tables.Table tableTop = section.AddTable();
        MigraDoc.DocumentObjectModel.Tables.Table tableTop = section.Headers.Primary.AddTable();
        tableTop.Style               = "Table";
        tableTop.Borders.Color       = MigraDoc.DocumentObjectModel.Colors.Blue;
        tableTop.Borders.Width       = 0.25;
        tableTop.Borders.Left.Width  = 0.5;
        tableTop.Borders.Right.Width = 0.5;
        tableTop.Rows.LeftIndent     = 0;

        // Before you can add a row, you must define the columns
        Column columnTop = tableTop.AddColumn("8cm");

        columnTop.Format.Alignment = ParagraphAlignment.Left;
        columnTop = tableTop.AddColumn("3cm");
        columnTop.Format.Alignment = ParagraphAlignment.Left;
        columnTop = tableTop.AddColumn("7cm");
        columnTop.Format.Alignment = ParagraphAlignment.Left;

        Row rowTop = tableTop.AddRow();

        rowTop.Borders.Left.Visible   = false;
        rowTop.Borders.Right.Visible  = false;
        rowTop.Borders.Top.Visible    = false;
        rowTop.Borders.Bottom.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Borders.Left.Visible   = false;
        rowTop.Borders.Right.Visible  = false;
        rowTop.Borders.Top.Visible    = false;
        rowTop.Borders.Bottom.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Borders.Left.Visible   = false;
        rowTop.Borders.Right.Visible  = false;
        rowTop.Borders.Top.Visible    = false;
        rowTop.Borders.Bottom.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Borders.Left.Visible  = false;
        rowTop.Borders.Right.Visible = false;
        rowTop.Borders.Top.Visible   = false;
        //rowTop.Borders.Bottom.Visible = false;
        rowTop.Cells[0].AddParagraph();
        rowTop.Cells[0].Borders.Bottom.Visible = false;
        rowTop.Cells[1].AddParagraph();
        rowTop.Cells[2].AddParagraph();


        rowTop = tableTop.AddRow();
        rowTop.Cells[0].AddParagraph("From:");
        rowTop.Cells[0].AddParagraph("CAPITAL DIGITAL");
        rowTop.Cells[0].AddParagraph("NO. 1, JALAN BUNGA RAYA 1, LANGKAWI MALL");
        rowTop.Cells[0].AddParagraph("07000 KUAH, LANGKAWI");
        rowTop.Cells[0].AddParagraph("KEDAH DARUL AMAN");
        rowTop.Cells[0].AddParagraph("www.capitaldigital.com.my");
        rowTop.Cells[0].Borders.Left.Visible   = false;
        rowTop.Cells[0].Borders.Right.Visible  = false;
        rowTop.Cells[0].Borders.Top.Visible    = false;
        rowTop.Cells[0].Borders.Bottom.Visible = false;
        rowTop.Cells[0].MergeDown = 5;
        rowTop.Cells[1].AddParagraph("Order No");
        rowTop.Cells[1].Borders.Right.Visible = false;
        rowTop.Cells[2].AddParagraph(": " + oModOrder.GetSetorderno);
        rowTop.Cells[2].Borders.Left.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[1].AddParagraph("Date");
        rowTop.Cells[1].Borders.Right.Visible = false;
        rowTop.Cells[2].AddParagraph(": " + oModOrder.GetSetorderdate);
        rowTop.Cells[2].Borders.Left.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[1].AddParagraph("Type");
        rowTop.Cells[1].Borders.Right.Visible = false;
        rowTop.Cells[2].AddParagraph(": " + oModOrder.GetSetordertype);
        rowTop.Cells[2].Borders.Left.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[1].AddParagraph("Sales Office");
        rowTop.Cells[1].Borders.Right.Visible = false;
        rowTop.Cells[2].AddParagraph(": CAPITAL DIGITAL LANGKAWI");
        rowTop.Cells[2].Borders.Left.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[1].AddParagraph("Sales Person");
        rowTop.Cells[1].Borders.Right.Visible = false;
        rowTop.Cells[2].AddParagraph(": HAZZARUL ANAS");
        rowTop.Cells[2].Borders.Left.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[0].Borders.Bottom.Visible = false;
        rowTop.Cells[1].AddParagraph("Contact No");
        rowTop.Cells[1].Borders.Right.Visible = false;
        rowTop.Cells[2].AddParagraph(": +6017-552 4447");
        rowTop.Cells[2].Borders.Left.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[0].AddParagraph("");
        rowTop.Cells[0].MergeRight             = 2;
        rowTop.Cells[0].Borders.Left.Visible   = false;
        rowTop.Cells[0].Borders.Right.Visible  = false;
        rowTop.Cells[0].Borders.Top.Visible    = false;
        rowTop.Cells[0].Borders.Bottom.Visible = false;
        rowTop.Cells[2].Borders.Right.Visible  = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[0].AddParagraph("To: ");
        rowTop.Cells[0].AddParagraph(oModOrder.GetSetbpdesc);
        rowTop.Cells[0].AddParagraph(oModOrder.GetSetbpaddress);
        rowTop.Cells[0].AddParagraph("Contact: " + oModOrder.GetSetbpcontact);
        rowTop.Cells[0].Borders.Left.Visible   = false;
        rowTop.Cells[0].Borders.Right.Visible  = false;
        rowTop.Cells[0].Borders.Bottom.Visible = false;
        rowTop.Cells[1].AddParagraph("Support: ");
        rowTop.Cells[1].AddParagraph("HAZZARUL ANAS HALIM");
        rowTop.Cells[1].AddParagraph("SALES & SUPPORT");
        rowTop.Cells[1].AddParagraph("Contact: +6017-552 4447");
        rowTop.Cells[1].Borders.Left.Visible   = false;
        rowTop.Cells[1].Borders.Right.Visible  = false;
        rowTop.Cells[1].Borders.Bottom.Visible = false;
        rowTop.Cells[1].MergeRight             = 1;
        rowTop.Cells[2].Borders.Right.Visible  = false;

        // Create the item table
        MigraDoc.DocumentObjectModel.Tables.Table table = section.AddTable();
        table.Style               = "Table";
        table.Borders.Color       = MigraDoc.DocumentObjectModel.Colors.Blue;
        table.Borders.Width       = 0.25;
        table.Borders.Left.Width  = 0.5;
        table.Borders.Right.Width = 0.5;
        table.Rows.LeftIndent     = 0;

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

        column.Format.Alignment = ParagraphAlignment.Center;

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

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

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

        column = table.AddColumn("2cm");
        column.Format.Alignment = ParagraphAlignment.Center;

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

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

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

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

        // 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    = MigraDoc.DocumentObjectModel.Colors.LightGray;
        row.Cells[0].AddParagraph("NO.");
        row.Cells[0].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[0].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[1].AddParagraph("ITEM NO");
        row.Cells[1].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[1].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[2].AddParagraph("DESCRIPTION");
        row.Cells[2].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[2].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[3].AddParagraph("UNIT PRICE");
        row.Cells[3].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[3].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[4].AddParagraph("DISCOUNT");
        row.Cells[4].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[4].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[5].AddParagraph("QTY");
        row.Cells[5].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[5].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[6].AddParagraph("PRICE");
        row.Cells[6].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[6].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[7].AddParagraph("TAX");
        row.Cells[7].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[7].VerticalAlignment = VerticalAlignment.Bottom;
        row.Cells[8].AddParagraph("TOTAL");
        row.Cells[8].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[8].VerticalAlignment = VerticalAlignment.Bottom;

        for (int i = 0; i < lsOrderLineItem.Count; i++)
        {
            MainModel modOrdDet = (MainModel)lsOrderLineItem[i];

            // Each item fills two rows
            Row row1 = table.AddRow();
            row1.Height     = "2cm";
            row1.TopPadding = 1.5;
            //row1.Cells[0].VerticalAlignment = VerticalAlignment.Center;
            row1.Cells[0].Format.Alignment = ParagraphAlignment.Center;
            row1.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            row1.Cells[2].Format.Alignment = ParagraphAlignment.Left;
            row1.Cells[3].Format.Alignment = ParagraphAlignment.Right;
            row1.Cells[4].Format.Alignment = ParagraphAlignment.Right;
            row1.Cells[5].Format.Alignment = ParagraphAlignment.Center;
            row1.Cells[6].Format.Alignment = ParagraphAlignment.Right;
            row1.Cells[7].Format.Alignment = ParagraphAlignment.Right;
            row1.Cells[8].Format.Alignment = ParagraphAlignment.Right;

            row1.Cells[0].AddParagraph((i + 1).ToString());
            row1.Cells[1].AddParagraph(modOrdDet.GetSetitemno);
            row1.Cells[2].AddParagraph(modOrdDet.GetSetitemdesc);
            row1.Cells[3].AddParagraph(modOrdDet.GetSetunitprice.ToString("#,##0.00"));
            row1.Cells[4].AddParagraph(modOrdDet.GetSetdiscamount.ToString("#,##0.00"));
            row1.Cells[5].AddParagraph(modOrdDet.GetSetquantity.ToString());
            row1.Cells[6].AddParagraph(modOrdDet.GetSetorderprice.ToString("#,##0.00"));
            row1.Cells[7].AddParagraph(modOrdDet.GetSettaxamount.ToString("#,##0.00"));
            row1.Cells[8].AddParagraph(modOrdDet.GetSettotalprice.ToString("#,##0.00"));

            if (i > 0 && ((i + 1) % 6) == 0)
            {
                row1.Cells[0].Borders.Bottom.Visible = true;
                row1.Cells[1].Borders.Bottom.Visible = true;
                row1.Cells[2].Borders.Bottom.Visible = true;
                row1.Cells[3].Borders.Bottom.Visible = true;
                row1.Cells[4].Borders.Bottom.Visible = true;
                row1.Cells[5].Borders.Bottom.Visible = true;
                row1.Cells[6].Borders.Bottom.Visible = true;
                row1.Cells[7].Borders.Bottom.Visible = true;
                row1.Cells[8].Borders.Bottom.Visible = true;
            }
            else
            {
                row1.Cells[0].Borders.Bottom.Visible = false;
                row1.Cells[1].Borders.Bottom.Visible = false;
                row1.Cells[2].Borders.Bottom.Visible = false;
                row1.Cells[3].Borders.Bottom.Visible = false;
                row1.Cells[4].Borders.Bottom.Visible = false;
                row1.Cells[5].Borders.Bottom.Visible = false;
                row1.Cells[6].Borders.Bottom.Visible = false;
                row1.Cells[7].Borders.Bottom.Visible = false;
                row1.Cells[8].Borders.Bottom.Visible = false;
            }
        }
        if ((lsOrderLineItem.Count % 6) > 0)
        {
            int totalremainingrow = 6 - (lsOrderLineItem.Count % 6);
            for (int j = 0; j < totalremainingrow; j++)
            {
                Row rowRemain = table.AddRow();
                rowRemain.Height = "2cm";
                rowRemain.Cells[0].AddParagraph();
                rowRemain.Cells[1].AddParagraph();
                rowRemain.Cells[2].AddParagraph();
                rowRemain.Cells[3].AddParagraph();
                rowRemain.Cells[4].AddParagraph();
                rowRemain.Cells[5].AddParagraph();
                rowRemain.Cells[6].AddParagraph();
                rowRemain.Cells[7].AddParagraph();
                rowRemain.Cells[8].AddParagraph();

                if (j == (totalremainingrow - 1))
                {
                    rowRemain.Cells[0].Borders.Bottom.Visible = true;
                    rowRemain.Cells[1].Borders.Bottom.Visible = true;
                    rowRemain.Cells[2].Borders.Bottom.Visible = true;
                    rowRemain.Cells[3].Borders.Bottom.Visible = true;
                    rowRemain.Cells[4].Borders.Bottom.Visible = true;
                    rowRemain.Cells[5].Borders.Bottom.Visible = true;
                    rowRemain.Cells[6].Borders.Bottom.Visible = true;
                    rowRemain.Cells[7].Borders.Bottom.Visible = true;
                    rowRemain.Cells[8].Borders.Bottom.Visible = true;
                }
                else if (j > 0 && (j % (totalremainingrow - 1)) == 0)
                {
                    rowRemain.Cells[0].Borders.Bottom.Visible = true;
                    rowRemain.Cells[1].Borders.Bottom.Visible = true;
                    rowRemain.Cells[2].Borders.Bottom.Visible = true;
                    rowRemain.Cells[3].Borders.Bottom.Visible = true;
                    rowRemain.Cells[4].Borders.Bottom.Visible = true;
                    rowRemain.Cells[5].Borders.Bottom.Visible = true;
                    rowRemain.Cells[6].Borders.Bottom.Visible = true;
                    rowRemain.Cells[7].Borders.Bottom.Visible = true;
                    rowRemain.Cells[8].Borders.Bottom.Visible = true;
                }
                else
                {
                    rowRemain.Cells[0].Borders.Bottom.Visible = false;
                    rowRemain.Cells[1].Borders.Bottom.Visible = false;
                    rowRemain.Cells[2].Borders.Bottom.Visible = false;
                    rowRemain.Cells[3].Borders.Bottom.Visible = false;
                    rowRemain.Cells[4].Borders.Bottom.Visible = false;
                    rowRemain.Cells[5].Borders.Bottom.Visible = false;
                    rowRemain.Cells[6].Borders.Bottom.Visible = false;
                    rowRemain.Cells[7].Borders.Bottom.Visible = false;
                    rowRemain.Cells[8].Borders.Bottom.Visible = false;
                }
            }
        }

        /*
         * Row rowTax = table.AddRow();
         * //rowTax.Height = "1cm";
         * rowTax.Cells[0].AddParagraph();
         * rowTax.Cells[0].Borders.Left.Visible = false;
         * rowTax.Cells[0].Borders.Right.Visible = false;
         * rowTax.Cells[0].Borders.Bottom.Visible = false;
         * rowTax.Cells[0].MergeRight = 6;
         * rowTax.Cells[7].AddParagraph("TAX");
         * rowTax.Cells[7].Format.Alignment = ParagraphAlignment.Left;
         * rowTax.Cells[8].AddParagraph(oModOrder.GetSettaxamount.ToString("#,##0.00"));
         * rowTax.Cells[8].Format.Alignment = ParagraphAlignment.Right;
         */

        Row rowTot = table.AddRow();

        rowTot.Height           = "1cm";
        rowTot.Format.Font.Bold = true;
        rowTot.Cells[0].AddParagraph();
        rowTot.Cells[0].Borders.Left.Visible   = false;
        rowTot.Cells[0].Borders.Right.Visible  = false;
        rowTot.Cells[0].Borders.Bottom.Visible = false;
        rowTot.Cells[0].MergeRight             = 6;

        /*
         * rowTot.Cells[1].AddParagraph();
         * rowTot.Cells[1].Borders.Left.Visible = false;
         * rowTot.Cells[2].AddParagraph();
         * rowTot.Cells[2].Borders.Left.Visible = false;
         * rowTot.Cells[3].AddParagraph();
         * rowTot.Cells[3].Borders.Left.Visible = false;
         * rowTot.Cells[4].AddParagraph();
         * rowTot.Cells[4].Borders.Left.Visible = false;
         * rowTot.Cells[5].AddParagraph();
         * rowTot.Cells[5].Borders.Left.Visible = false;
         * rowTot.Cells[6].AddParagraph();
         * rowTot.Cells[6].Borders.Left.Visible = false;
         */
        rowTot.Cells[6].Borders.Right.Visible = false;

        rowTot.Cells[7].AddParagraph("GRAND TOTAL");
        rowTot.Cells[7].Format.Alignment     = ParagraphAlignment.Left;
        rowTot.Cells[7].VerticalAlignment    = VerticalAlignment.Center;
        rowTot.Cells[7].Borders.Left.Visible = false;
        //rowTot.Cells[7].Borders.Right.Visible = false;
        rowTot.Cells[7].Borders.Bottom.Visible = false;

        rowTot.Cells[8].AddParagraph(oModOrder.GetSettotalamount.ToString("#,##0.00"));
        rowTot.Cells[8].Format.Alignment  = ParagraphAlignment.Right;
        rowTot.Cells[8].VerticalAlignment = VerticalAlignment.Center;

        //footer.AddText("Footer");
        //footer.Format.Font.Size = 9;
        //footer.Format.Alignment = ParagraphAlignment.Center;

        // Create the item table for footer
        //MigraDoc.DocumentObjectModel.Tables.Table tblBtm = section.Headers.Primary.AddImage(logo_lima);
        MigraDoc.DocumentObjectModel.Tables.Table tblBtm = section.Footers.Primary.AddTable();
        //MigraDoc.DocumentObjectModel.Tables.Table tblBtm = section.AddTable();
        tblBtm.Style               = "Table";
        tblBtm.Borders.Color       = MigraDoc.DocumentObjectModel.Colors.Blue;
        tblBtm.Borders.Width       = 0.25;
        tblBtm.Borders.Left.Width  = 0.5;
        tblBtm.Borders.Right.Width = 0.5;
        tblBtm.Rows.LeftIndent     = 0;

        // Before you can add a row, you must define the columns
        Column colTblBtm = tblBtm.AddColumn("6cm");

        colTblBtm.Format.Alignment = ParagraphAlignment.Left;
        colTblBtm = tblBtm.AddColumn("6cm");
        colTblBtm.Format.Alignment = ParagraphAlignment.Left;
        colTblBtm = tblBtm.AddColumn("6cm");
        colTblBtm.Format.Alignment = ParagraphAlignment.Left;

        Row rowTblBtm = tblBtm.AddRow();

        rowTblBtm.Borders.Left.Visible  = false;
        rowTblBtm.Borders.Right.Visible = false;
        rowTblBtm.Borders.Top.Visible   = false;
        //rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph("Remarks:");
        rowTblBtm.Cells[0].MergeRight = 2;

        rowTblBtm = tblBtm.AddRow();
        //rowTblBtm.Borders.Left.Visible = false;
        //rowTblBtm.Borders.Right.Visible = false;
        //rowTblBtm.Borders.Top.Visible = false;
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph(oModOrder.GetSetorderremarks);
        rowTblBtm.Cells[0].MergeRight = 2;

        rowTblBtm        = tblBtm.AddRow();
        rowTblBtm.Height = "2cm";
        //rowTblBtm.Borders.Left.Visible = false;
        //rowTblBtm.Borders.Right.Visible = false;
        rowTblBtm.Borders.Top.Visible = false;
        //rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph();
        rowTblBtm.Cells[0].MergeRight = 2;

        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Left.Visible   = false;
        rowTblBtm.Borders.Right.Visible  = false;
        rowTblBtm.Borders.Top.Visible    = false;
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph("1. Once the order is confirmed, any cancellation and changes of the order is not allowed.");
        rowTblBtm.Cells[0].MergeRight = 2;

        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Left.Visible   = false;
        rowTblBtm.Borders.Right.Visible  = false;
        rowTblBtm.Borders.Top.Visible    = false;
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph("2. Delivery lead time is 3 working days upon receive the confirmed Work Order & advert content.");
        rowTblBtm.Cells[0].MergeRight = 2;

        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Left.Visible   = false;
        rowTblBtm.Borders.Right.Visible  = false;
        rowTblBtm.Borders.Top.Visible    = false;
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph("3. All prices are subject to change without any prior notices.");
        rowTblBtm.Cells[0].MergeRight = 2;

        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Left.Visible  = false;
        rowTblBtm.Borders.Right.Visible = false;
        rowTblBtm.Borders.Top.Visible   = false;
        //rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph();
        rowTblBtm.Cells[0].MergeRight = 1;
        rowTblBtm.Cells[2].AddParagraph();
        rowTblBtm.Cells[2].Borders.Bottom.Visible = false;

        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Format.Font.Bold = true;
        rowTblBtm.Cells[0].AddParagraph(oModOrder.GetSetbpdesc);
        //rowTblBtm.Cells[0].Borders.Top.Visible = true;
        rowTblBtm.Cells[1].AddParagraph("CAPITAL DIGITAL");
        rowTblBtm.Cells[2].AddParagraph();
        rowTblBtm.Cells[2].Borders.Left.Visible   = false;
        rowTblBtm.Cells[2].Borders.Right.Visible  = false;
        rowTblBtm.Cells[2].Borders.Top.Visible    = false;
        rowTblBtm.Cells[2].Borders.Bottom.Visible = false;
        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph("Confirmed By: (Please stamp and sign)");
        rowTblBtm.Cells[1].AddParagraph("Checked By:");
        rowTblBtm.Cells[2].AddParagraph();
        rowTblBtm.Cells[2].Borders.Left.Visible   = false;
        rowTblBtm.Cells[2].Borders.Right.Visible  = false;
        rowTblBtm.Cells[2].Borders.Top.Visible    = false;
        rowTblBtm.Cells[2].Borders.Bottom.Visible = false;
        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Bottom.Visible          = false;
        rowTblBtm.Cells[2].Borders.Left.Visible   = false;
        rowTblBtm.Cells[2].Borders.Right.Visible  = false;
        rowTblBtm.Cells[2].Borders.Top.Visible    = false;
        rowTblBtm.Cells[2].Borders.Bottom.Visible = false;
        rowTblBtm.Height = "2cm";
        rowTblBtm        = tblBtm.AddRow();
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph("Name:");
        rowTblBtm.Cells[1].AddParagraph("Name: HAZZARUL ANAS HALIM");
        rowTblBtm.Cells[2].AddParagraph();
        rowTblBtm.Cells[2].Borders.Left.Visible   = false;
        rowTblBtm.Cells[2].Borders.Right.Visible  = false;
        rowTblBtm.Cells[2].Borders.Top.Visible    = false;
        rowTblBtm.Cells[2].Borders.Bottom.Visible = false;
        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph("Designation:");
        rowTblBtm.Cells[1].AddParagraph("Designation: Sales & Marketing Advisor");
        rowTblBtm.Cells[2].AddParagraph();
        rowTblBtm.Cells[2].Borders.Left.Visible   = false;
        rowTblBtm.Cells[2].Borders.Right.Visible  = false;
        rowTblBtm.Cells[2].Borders.Top.Visible    = false;
        rowTblBtm.Cells[2].Borders.Bottom.Visible = false;
        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Cells[0].AddParagraph("Date:");
        rowTblBtm.Cells[1].AddParagraph("Date:");
        rowTblBtm.Cells[2].AddParagraph();
        rowTblBtm.Cells[2].Borders.Left.Visible   = false;
        rowTblBtm.Cells[2].Borders.Right.Visible  = false;
        rowTblBtm.Cells[2].Borders.Top.Visible    = false;
        rowTblBtm.Cells[2].Borders.Bottom.Visible = false;

        // Create a renderer for PDF that uses Unicode font encoding
        PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true);

        // Set the MigraDoc document
        pdfRenderer.Document = doc;

        // Create the PDF document
        pdfRenderer.RenderDocument();

        // Save the document...
        string pdfFilename = sOrderNo + ".pdf";
        string file        = Server.MapPath("~/App_Data/" + pdfFilename);
        //string file = HttpContext.Current.Server.MapPath("~/pdf/" + pdfFilename);
        //string file = "C:/TEMP/" + pdfFilename;

        // ...and start a viewer //
        //pdfRenderer.Save(file);
        //Process.Start(file);

        // Send PDF to browser //
        MemoryStream stream = new MemoryStream();

        pdfRenderer.Save(stream, false);
        Response.Clear();
        Response.ContentType = "application/pdf";
        Response.AddHeader("content-length", stream.Length.ToString());
        Response.BinaryWrite(stream.ToArray());
        Response.Flush();
        stream.Close();
        Response.End();

        //download file //
        //Response.ContentType = "Application/pdf";
        //Response.AppendHeader("Content-Disposition", "attachment; filename=" + pdfFilename);
        //Response.TransmitFile(file);
        //Response.End();
    }
Beispiel #33
0
        /// <summary>
        /// Erstellt aus einer DataTable eine Micradoc Tabelle
        /// </summary>
        /// <param name="dt">DataTable</param>
        /// <param name="columnWidths">Spaltenbreite</param>
        /// <param name="shadedColumns">Spalten mit Schattierung</param>
        /// <param name="stretchToPageWidth">Gibt an ob die Tabelle auf das gesamte Blatt gestretcht werden soll</param>
        /// <returns>Micradoc Tabelle</returns>
        protected Table GetTableFromDataTable(DataTable dt, List<int> columnWidths, List<int> shadedColumns, bool stretchToPageWidth)
        {
            Table table = new Table();
            if (columnWidths != null)
            {
                foreach (int width in columnWidths)
                {
                    table.AddColumn(new Unit((double)width, UnitType.Millimeter));
                }
            }

            while (dt.Columns.Count > table.Columns.Count)
            {
                table.AddColumn();
            }

            if (stretchToPageWidth)
            {
                double pageWidth = this.Document.LastSection.PageSetup.PageWidth.Millimeter - this.Document.LastSection.PageSetup.LeftMargin.Millimeter - this.Document.LastSection.PageSetup.RightMargin.Millimeter;
                double columnWidthSum = 0;
                foreach (Column column in table.Columns)
                {
                    columnWidthSum += column.Width.Millimeter;
                }

                foreach (Column column in table.Columns)
                {
                    column.Width = new Unit(column.Width.Millimeter * pageWidth / columnWidthSum, UnitType.Millimeter);

                    if (!IsInvoice)
                    {
                        Border bor = new Border();
                        bor.Style = BorderStyle.Single;

                        column.Borders.Left = bor;

                        bor = new Border();
                        bor.Style = BorderStyle.Single;
                        column.Borders.Right = bor;
                    }
                }
            }

            var headerRow = table.AddRow();
            headerRow.HeadingFormat = true;
            headerRow.Format.Font.Bold = true;
            int i = 0;
            foreach (DataColumn dc in dt.Columns)
            {
                headerRow[i].AddParagraph(dc.ColumnName);
                headerRow[i].Shading.Color = this.TableShadingColor;
                i++;
            }

            foreach (DataRow dr in dt.Rows)
            {
                var row = table.AddRow(dr.ItemArray);
                row.Height = new Unit((IsInvoice)?0.5:0.8, UnitType.Centimeter);
                if (!IsInvoice)
                {
                    Border bor = new Border();
                    bor.Style = BorderStyle.Single;
                    row.Borders.Left = bor;
                    bor = new Border();
                    bor.Style = BorderStyle.Single;
                    row.Borders.Right = bor;

                    bor = new Border();
                    bor.Style = BorderStyle.Single;
                    row.Borders.Bottom = bor;
                }
                foreach (int sc in shadedColumns)
                {
                    row[sc].Shading.Color = this.TableShadingColor;
                }
            }

            table.SetEdge(0, 0, table.Columns.Count, 1, Edge.Box, BorderStyle.Single, new Unit(1, UnitType.Point));
            table.SetEdge(0, 1, table.Columns.Count, table.Rows.Count - 1, Edge.Box, BorderStyle.Single, new Unit(1, UnitType.Point));
            return table;
        }
Beispiel #34
0
        public Table generate(MannschaftskampfViewModel mannschaftskampfViewModel, CompetitionInfosViewModel zusatzInfos, double randLinksRechts)
        {
            var table = new Table();

            table.Style = CustomStyles.TABLEINFO;

            table.Borders.Visible = false;

            double a4LandscapeBreite = (29.7 - 2 * randLinksRechts) / 3.0;

            Column column = table.AddColumn($"{a4LandscapeBreite - 2}cm");

            column.Format.Alignment = ParagraphAlignment.Left;

            column = table.AddColumn($"{a4LandscapeBreite + 4}cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            column = table.AddColumn($"{a4LandscapeBreite - 2}cm");
            column.Format.Alignment = ParagraphAlignment.Right;


            Row zeile = table.AddRow();

            var spalte = zeile.Cells[0].AddParagraph();
            var ft     = spalte.AddFormattedText($"{mannschaftskampfViewModel.LigaId} {mannschaftskampfViewModel.TableId}", TextFormat.Bold);

            ft.Font.Size = CustomStyles.fontSizeGross;
            spalte.AddLineBreak();

            ft           = spalte.AddFormattedText($"{Resources.LanguageFiles.DictPluginMain.Location}:");
            ft.Font.Size = CustomStyles.fontSizeKlein;
            ft.Bold      = true;

            spalte.AddLineBreak();
            ft           = spalte.AddFormattedText($"{mannschaftskampfViewModel.Wettkampfstaette.Split(' ').Last()}");
            ft.Font.Size = CustomStyles.fontSizeNormal;

            spalte       = zeile.Cells[1].AddParagraph();
            ft           = spalte.AddFormattedText(zusatzInfos.Kampfart, TextFormat.Bold);
            ft.Font.Size = CustomStyles.fontSizeGross;
            spalte.AddLineBreak();

            ft           = spalte.AddFormattedText($"{Resources.LanguageFiles.DictPluginMain.LocationAddress}:");
            ft.Font.Size = CustomStyles.fontSizeKlein;
            ft.Bold      = true;

            spalte.AddLineBreak();
            ft           = spalte.AddFormattedText($"{mannschaftskampfViewModel.Wettkampfstaette}");
            ft.Font.Size = CustomStyles.fontSizeNormal;

            spalte       = zeile.Cells[2].AddParagraph();
            ft           = spalte.AddFormattedText(zusatzInfos.VorKampfRueckKampf, TextFormat.Bold);
            ft.Font.Size = CustomStyles.fontSizeGross;

            spalte.AddLineBreak();
            ft           = spalte.AddFormattedText($"{Resources.LanguageFiles.DictPluginMain.BoutDate}:");
            ft.Font.Size = CustomStyles.fontSizeKlein;
            ft.Bold      = true;

            spalte.AddLineBreak();
            ft           = spalte.AddFormattedText($"{mannschaftskampfViewModel.Kampfdatum.ToShortDateString()}");
            ft.Font.Size = CustomStyles.fontSizeNormal;

            return(table);
        }
Beispiel #35
0
        private void backgroundInviTask()
        {
            if (WorkingFolder.Equals(""))
            {
                FolderBrowserDialog fbd = new FolderBrowserDialog();
                DialogResult result = fbd.ShowDialog();
                WorkingFolder = fbd.SelectedPath;
            }
            string file = txtInvigilatorsFile.Text;
            StreamReader File1 = new StreamReader(file);
            Directory.CreateDirectory(WorkingFolder + "/Invigilations");
            StreamWriter writer1 = new StreamWriter(WorkingFolder + "/InvigilatorEmails.csv");
            StreamWriter writer = new StreamWriter(WorkingFolder + "/Invigilators2.csv");
            StreamWriter writer2 = new StreamWriter(WorkingFolder + "/Invigilators.id");
            string line = "";
            List<string> lines = new List<string>();
            try
            {
                string s = "", s1 = "";
                while ((line = File1.ReadLine()) != null)
                {
                    if (line.StartsWith("Instructor-in-charge  Prof./ Dr./ Mr./ Ms. "))
                    {
                        s = s1 + s;
                        lines.Add(s); s = ""; s1 = line;
                    }
                    else
                    {
                        s += line + "\n";
                    }
                }
                int x = 0;
                foreach (string st in lines)
                {
                    if (x != 0)
                    {
                        s = ""; s1 = "";
                        string[] arr = st.Split('\n');
                        string Name = arr[0].Substring(44, arr[0].IndexOf(',') - 44);
                        writer1.WriteLine(Name);
                        Document document = new Document();
                        document.Info.Title = Name;
                        document.Info.Subject = "Details of rooms and invigilators for your course(s)";
                        document.Info.Author = "BPHC-Instruction Division";
                        getStyles(document);

                        Section section = document.AddSection();
                        section.PageSetup.Orientation = MigraDoc.DocumentObjectModel.Orientation.Landscape;
                        Paragraph paragraph = section.AddParagraph("BIRLA INSTITUTE OF TECHNOLOGY AND SCIENCE-PILANI, HYDERABAD CAMPUS", "Heading1");
                        paragraph.Format.Alignment = ParagraphAlignment.Center;
                        paragraph = section.AddParagraph("INSTRUCTION DIVISION", "Heading1");
                        paragraph.Format.Alignment = ParagraphAlignment.Center;
                        paragraph = section.AddParagraph("FIRST SEMESTER 2015-2016", "Heading2");
                        paragraph.Format.Alignment = ParagraphAlignment.Center;
                        section.AddParagraph(arr[0].Replace(",", " "), "Heading2");
                        section.AddParagraph("Details of rooms and invigilators for your course(s):", "Heading2");
                        Table table = new Table();
                        Column column = table.AddColumn(Unit.FromCentimeter(1.3));column.Format.Alignment = ParagraphAlignment.Center;
                        table.AddColumn(Unit.FromCentimeter(2)).Format.Alignment = ParagraphAlignment.Center;
                        table.AddColumn(Unit.FromCentimeter(4)).Format.Alignment = ParagraphAlignment.Center;
                        table.AddColumn(Unit.FromCentimeter(2)).Format.Alignment = ParagraphAlignment.Center;
                        table.AddColumn(Unit.FromCentimeter(2.5)).Format.Alignment = ParagraphAlignment.Center;
                        table.AddColumn(Unit.FromCentimeter(4)).Format.Alignment = ParagraphAlignment.Center;
                        table.AddColumn(Unit.FromCentimeter(6)).Format.Alignment = ParagraphAlignment.Center;
                        table.AddColumn(Unit.FromCentimeter(2)).Format.Alignment = ParagraphAlignment.Center;
                        table.Borders.Width = 0.75;
                        Row row = table.AddRow();
                        row.Shading.Color = MigraDoc.DocumentObjectModel.Colors.PaleGoldenrod;
                        Cell cell = row.Cells[0];
                        cell.AddParagraph("CODE");
                        cell = row.Cells[1];
                        cell.AddParagraph("COURSE NO");
                        cell = row.Cells[2];
                        cell.AddParagraph("COURSE TITLE");
                        cell = row.Cells[3];
                        cell.AddParagraph("DATE");
                        cell = row.Cells[4];
                        cell.AddParagraph("TIME");
                        cell = row.Cells[5];
                        cell.AddParagraph("ROOM");
                        cell = row.Cells[6];
                        cell.AddParagraph("INVIGILATOR");
                        cell = row.Cells[7];
                        cell.AddParagraph("GROUP");

                        writer.WriteLine(arr[0]);
                        List<string> lines1 = new List<string>();

                        for (int i = 6; i < arr.Length; i += 3)
                        {
                            while (arr[i].Equals(",,,,,,,,,,,,,,,,,,,,,")) { i++; }
                            if (arr[i].StartsWith("\"1. In courses with less strength"))
                            {
                                s = s1 + s;
                                if (!s1.Equals(""))
                                    lines1.Add(s);
                                s = ""; s1 = "";
                                break;
                            }
                            if (arr[i].StartsWith(",,,,,,,,,,,,,,,")) s += arr[i] + "\n";
                            else
                            {
                                s = s1 + s;
                                if (!s1.Equals(""))
                                    lines1.Add(s);
                                s = "";
                                if (arr[i].StartsWith("\""))
                                {
                                    s1 = arr[i][1] + "" + arr[i][3] + "" + arr[i][4] + "" + arr[i][5] + arr[i].Substring(7) + "\n";
                                }
                                else
                                    s1 = arr[i] + "\n";
                            }
                        }
                        foreach (string str in lines1)
                        {
                            writer.WriteLine(str);
                            string[] ard = str.Split('\n');
                            int xd = 0;
                            string line1 = "";
                            foreach (string xc in ard)
                            {
                                string[] ds = xc.Split(',');
                                if (ds.Length < 13)
                                { continue; }
                                if (xd == 0)
                                {
                                    row = table.AddRow();
                                    cell = row.Cells[0];
                                    cell.AddParagraph(ds[0]);
                                    cell = row.Cells[1];
                                    cell.AddParagraph(ds[2] + " " + ds[3]);
                                    cell = row.Cells[2];
                                    cell.AddParagraph(ds[5]);
                                    cell = row.Cells[3];
                                    if (ds[7].IndexOf('\"') == -1) { int lh = xc.IndexOf(ds[8]);
                                        string ab = xc.Substring(lh);
                                        string bc = xc.Substring(0, lh);
                                        ds = (bc + "," + ab).Split(',');
                                    }
                                    cell.AddParagraph((ds[7]+","+ds[8]).Replace("\"", ""));
                                    cell = row.Cells[4];
                                    cell.AddParagraph(ds[9]);
                                    line1 += ds[2] + " " + ds[3] + ","+ ds[5] + ","+ (ds[7] + "," + ds[8]).Replace("\"", "") + ","+ ds[9].Replace(" ","") + ",";
                                    if (ds[12].StartsWith("\""))
                                    {
                                        int ld = xc.IndexOf(ds[12]);
                                        string rooms = xc.Substring(ld + 1, xc.IndexOf('\"', ld + 2) - ld - 1);
                                        cell = row.Cells[5];
                                        cell.AddParagraph(rooms);
                                        //line1 += rooms.Replace(',','|')+",";
                                    }
                                    else
                                    {
                                        cell = row.Cells[5];
                                        cell.AddParagraph(ds[12]);
                                        //line1 +=  ds[12] + ",";
                                    }
                                    int lc = ds.Length;
                                    cell = row.Cells[6];
                                    cell.AddParagraph(ds[lc - 7]);
                                    cell = row.Cells[7];
                                    cell.AddParagraph(ds[lc - 3]);
                                    line1 += ds[lc - 7] + ":";//+ ds[lc - 3]+"|";
                                    xd++;
                                }
                                else
                                {
                                    row = table.AddRow();
                                    cell = row.Cells[6];
                                    cell.AddParagraph(ds[15]);
                                    cell = row.Cells[7];
                                    cell.AddParagraph(ds[19]);
                                    line1 += ds[15] + ":";//+ ds[19]+"|";
                                }
                            }
                            writer2.WriteLine(line1);
                            line1 = "";
                        }
                        section.Add(table);
                        section.AddParagraph("1. In courses with less strength (viz. a course in which upto 45 students are registered), the Instructor-In-Charge is the only invigilator.", "Heading3");
                        section.AddParagraph("2. In case of any problems, contact  Prof. P K Sahoo (In-charge, Test Scheduling).", "Heading3");
                        paragraph = section.AddParagraph("ASSOCIATE DEAN", "Heading2");
                        paragraph.Format.Alignment = ParagraphAlignment.Right;
                        paragraph = section.AddParagraph("INSTRUCTION DIVISION", "Heading2");
                        paragraph.Format.Alignment = ParagraphAlignment.Right;
                        MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToFile(document, "MigraDoc.mdddl");
                        PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always);
                        renderer.Document = document;
                        renderer.RenderDocument();
                        // Save the document...
                        string filename = WorkingFolder + "/Invigilations/" + Name + ".pdf";
                        renderer.PdfDocument.Save(filename);
                        writer.WriteLine("-,-,-,-,-,-,-,-,-,--,-,-,-,-,-,-,-,-,-,-,-,-,--,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-,-");
                        //writer.WriteLine(st);
                    }
                    x = 1;
                }
            }
            catch (Exception e1)
            {
            }
            File1.Close();
            writer.Close();
            writer1.Close();
            writer2.Close();
            txtInvigilators.Text = WorkingFolder + "/Invigilators.id";
        }
Beispiel #36
0
    private void generatePDFFile()
    {
        // Create a MigraDoc document
        Document doc = new Document();

        doc.Info.Title   = "Expenses";
        doc.Info.Subject = "Expenses No:" + oModExpenses.GetSetexpensesno;
        doc.Info.Author  = "B.I.O.App System";

        //set page orientation
        doc.DefaultPageSetup.Orientation    = MigraDoc.DocumentObjectModel.Orientation.Portrait;
        doc.DefaultPageSetup.TopMargin      = "7.5cm"; //120
        doc.DefaultPageSetup.BottomMargin   = "8.5cm"; //150
        doc.DefaultPageSetup.LeftMargin     = 40;
        doc.DefaultPageSetup.RightMargin    = 40;
        doc.DefaultPageSetup.HeaderDistance = "1.5cm"; //20
        doc.DefaultPageSetup.FooterDistance = "5.5cm"; //20

        MigraDoc.DocumentObjectModel.Style style = doc.Styles["Normal"];
        // Because all styles are derived from Normal, the next line changes the
        // font of the whole document. Or, more exactly, it changes the font of
        // all styles and paragraphs that do not redefine the font.
        style.Font.Name = "Verdana";

        // Create a new style called Table based on style Normal
        style           = doc.Styles.AddStyle("Table", "Normal");
        style.Font.Name = "Verdana";
        style.Font.Name = "Arial";
        style.Font.Size = 8;

        // Each MigraDoc document needs at least one section.
        Section section = doc.AddSection();

        // Put Capital Digital logo in the header

        /*
         * string logo_lima = Server.MapPath("~/images/logo_CD_bgBLUE_BLACK_310x98.png");
         * MigraDoc.DocumentObjectModel.Shapes.Image image = section.Headers.Primary.AddImage(logo_lima);
         * image.Height = "1cm";
         * image.LockAspectRatio = true;
         * image.RelativeVertical = RelativeVertical.Line;
         * image.RelativeHorizontal = RelativeHorizontal.Margin;
         * image.Top = ShapePosition.Top;
         * image.Left = ShapePosition.Right;
         * image.WrapFormat.Style = WrapStyle.Through;
         */
        // Put CD logo in the header

        /*
         * string logo_mod = Server.MapPath("~/images/logo_versi_4.png");
         * MigraDoc.DocumentObjectModel.Shapes.Image image2 = section.Headers.Primary.AddImage(logo_mod);
         * image2.Height = "1.5cm";
         * image2.LockAspectRatio = true;
         * image2.RelativeVertical = RelativeVertical.Line;
         * image2.RelativeHorizontal = RelativeHorizontal.Margin;
         * image2.Top = ShapePosition.Top;
         * image2.Left = ShapePosition.Left;
         * image2.WrapFormat.Style = WrapStyle.Through;
         */

        // Create Header

        Paragraph header2 = section.Headers.Primary.AddParagraph();

        header2.AddText(modCompInfo.GetSetcomp_name);
        header2.Format.Font.Size = 8;
        header2.Format.Font.Bold = true;
        header2.Format.Alignment = ParagraphAlignment.Center;

        Paragraph header3 = section.Headers.Primary.AddParagraph();

        header3.AddText(modCompInfo.GetSetcomp_address);
        header3.Format.Font.Size = 7;
        header3.Format.Font.Bold = false;
        header3.Format.Alignment = ParagraphAlignment.Center;

        header3 = section.Headers.Primary.AddParagraph();
        header3.AddText("website: " + modCompInfo.GetSetcomp_website);
        header3.Format.Font.Size = 7;
        header3.Format.Font.Bold = false;
        header3.Format.Alignment = ParagraphAlignment.Center;

        header3 = section.Headers.Primary.AddParagraph();
        header3.AddText("Tel: " + modCompInfo.GetSetcomp_contactno);
        header3.Format.Font.Size = 7;
        header3.Format.Font.Bold = false;
        header3.Format.Alignment = ParagraphAlignment.Center;

        Paragraph header = section.Headers.Primary.AddParagraph();

        header.AddText("");
        header.Format.Font.Size = 12;
        header.Format.Font.Bold = true;
        header.Format.Alignment = ParagraphAlignment.Center;

        header = section.Headers.Primary.AddParagraph();
        header.AddText("VOUCHER BAYARAN");
        header.Format.Font.Size = 12;
        header.Format.Font.Bold = true;
        header.Format.Alignment = ParagraphAlignment.Center;


        // Create main section for Sales Order
        //Paragraph main = section.AddParagraph();
        // main = section.AddParagraph();
        //main.Format.SpaceBefore = 1;

        // Create the item table for header
        //MigraDoc.DocumentObjectModel.Tables.Table tableTop = section.AddTable();
        MigraDoc.DocumentObjectModel.Tables.Table tableTop = section.Headers.Primary.AddTable();
        tableTop.Style               = "Table";
        tableTop.Borders.Color       = MigraDoc.DocumentObjectModel.Colors.Blue;
        tableTop.Borders.Width       = 0.25;
        tableTop.Borders.Left.Width  = 0.5;
        tableTop.Borders.Right.Width = 0.5;
        tableTop.Rows.LeftIndent     = 0;

        // Before you can add a row, you must define the columns
        Column columnTop = tableTop.AddColumn("2cm");

        columnTop.Format.Alignment = ParagraphAlignment.Left;
        columnTop = tableTop.AddColumn("7cm");
        columnTop.Format.Alignment = ParagraphAlignment.Left;
        columnTop = tableTop.AddColumn("2cm");
        columnTop.Format.Alignment = ParagraphAlignment.Left;
        columnTop = tableTop.AddColumn("2cm");
        columnTop.Format.Alignment = ParagraphAlignment.Left;
        columnTop = tableTop.AddColumn("5cm");
        columnTop.Format.Alignment = ParagraphAlignment.Left;

        Row rowTop = tableTop.AddRow();

        rowTop.Borders.Left.Visible   = false;
        rowTop.Borders.Right.Visible  = false;
        rowTop.Borders.Top.Visible    = false;
        rowTop.Borders.Bottom.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Borders.Left.Visible   = false;
        rowTop.Borders.Right.Visible  = false;
        rowTop.Borders.Top.Visible    = false;
        rowTop.Borders.Bottom.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Borders.Left.Visible   = false;
        rowTop.Borders.Right.Visible  = false;
        rowTop.Borders.Top.Visible    = false;
        rowTop.Borders.Bottom.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Borders.Left.Visible   = false;
        rowTop.Borders.Right.Visible  = false;
        rowTop.Borders.Top.Visible    = false;
        rowTop.Borders.Bottom.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[0].AddParagraph("Bayar Kepada: ");
        rowTop.Cells[0].Borders.Left.Visible   = false;
        rowTop.Cells[0].Borders.Right.Visible  = false;
        rowTop.Cells[0].Borders.Bottom.Visible = false;
        rowTop.Cells[1].AddParagraph(oModExpenses.GetSetbpdesc);
        rowTop.Cells[1].Borders.Left.Visible   = false;
        rowTop.Cells[1].Borders.Right.Visible  = false;
        rowTop.Cells[1].Borders.Bottom.Visible = false;
        rowTop.Cells[2].AddParagraph();
        rowTop.Cells[2].Borders.Left.Visible   = false;
        rowTop.Cells[2].Borders.Right.Visible  = false;
        rowTop.Cells[2].Borders.Bottom.Visible = false;
        rowTop.Cells[3].AddParagraph("No. Bil & Belanja: ");
        rowTop.Cells[3].Borders.Left.Visible   = false;
        rowTop.Cells[3].Borders.Right.Visible  = false;
        rowTop.Cells[3].Borders.Bottom.Visible = false;
        rowTop.Cells[4].AddParagraph(oModExpenses.GetSetexpensesno);
        rowTop.Cells[4].Borders.Left.Visible   = false;
        rowTop.Cells[4].Borders.Right.Visible  = false;
        rowTop.Cells[4].Borders.Bottom.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[0].AddParagraph();
        rowTop.Cells[0].Borders.Left.Visible   = false;
        rowTop.Cells[0].Borders.Right.Visible  = false;
        rowTop.Cells[0].Borders.Bottom.Visible = false;
        rowTop.Cells[0].MergeDown = 2;
        rowTop.Cells[1].AddParagraph(oModExpenses.GetSetbpaddress);
        rowTop.Cells[1].AddParagraph(oModExpenses.GetSetbpcontact);
        rowTop.Cells[1].Borders.Left.Visible   = false;
        rowTop.Cells[1].Borders.Right.Visible  = false;
        rowTop.Cells[1].Borders.Bottom.Visible = false;
        rowTop.Cells[1].MergeDown = 2;
        rowTop.Cells[2].AddParagraph();
        rowTop.Cells[2].Borders.Left.Visible   = false;
        rowTop.Cells[2].Borders.Right.Visible  = false;
        rowTop.Cells[2].Borders.Bottom.Visible = false;
        rowTop.Cells[2].MergeDown = 2;
        rowTop.Cells[3].AddParagraph("Tarikh: ");
        rowTop.Cells[3].Borders.Left.Visible   = false;
        rowTop.Cells[3].Borders.Right.Visible  = false;
        rowTop.Cells[3].Borders.Bottom.Visible = false;
        rowTop.Cells[4].AddParagraph(oModExpenses.GetSetexpensesdate);
        rowTop.Cells[4].Borders.Left.Visible   = false;
        rowTop.Cells[4].Borders.Right.Visible  = false;
        rowTop.Cells[4].Borders.Bottom.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[3].AddParagraph("Status: ");
        rowTop.Cells[3].Borders.Left.Visible   = false;
        rowTop.Cells[3].Borders.Right.Visible  = false;
        rowTop.Cells[3].Borders.Bottom.Visible = false;
        rowTop.Cells[4].AddParagraph(oModExpenses.GetSetstatus);
        rowTop.Cells[4].Borders.Left.Visible   = false;
        rowTop.Cells[4].Borders.Right.Visible  = false;
        rowTop.Cells[4].Borders.Bottom.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[0].AddParagraph("Rujukan: ");
        rowTop.Cells[0].Borders.Left.Visible   = false;
        rowTop.Cells[0].Borders.Right.Visible  = false;
        rowTop.Cells[0].Borders.Bottom.Visible = false;
        rowTop.Cells[1].AddParagraph(oModExpenses.GetSetremarks);
        rowTop.Cells[1].Borders.Left.Visible   = false;
        rowTop.Cells[1].Borders.Right.Visible  = false;
        rowTop.Cells[1].Borders.Bottom.Visible = false;
        rowTop.Cells[2].AddParagraph();
        rowTop.Cells[2].Borders.Left.Visible   = false;
        rowTop.Cells[2].Borders.Right.Visible  = false;
        rowTop.Cells[2].Borders.Bottom.Visible = false;
        rowTop.Cells[3].AddParagraph();
        rowTop.Cells[3].Borders.Left.Visible   = false;
        rowTop.Cells[3].Borders.Right.Visible  = false;
        rowTop.Cells[3].Borders.Bottom.Visible = false;
        rowTop.Cells[4].AddParagraph();
        rowTop.Cells[4].Borders.Left.Visible   = false;
        rowTop.Cells[4].Borders.Right.Visible  = false;
        rowTop.Cells[4].Borders.Bottom.Visible = false;

        rowTop = tableTop.AddRow();
        rowTop.Cells[0].AddParagraph("Jenis Bayaran: ");
        rowTop.Cells[0].Borders.Left.Visible   = false;
        rowTop.Cells[0].Borders.Right.Visible  = false;
        rowTop.Cells[0].Borders.Bottom.Visible = false;
        rowTop.Cells[1].AddParagraph(oModExpenses.GetSetexpensestype);
        rowTop.Cells[1].Borders.Left.Visible   = false;
        rowTop.Cells[1].Borders.Right.Visible  = false;
        rowTop.Cells[1].Borders.Bottom.Visible = false;
        rowTop.Cells[2].AddParagraph();
        rowTop.Cells[2].Borders.Left.Visible   = false;
        rowTop.Cells[2].Borders.Right.Visible  = false;
        rowTop.Cells[2].Borders.Bottom.Visible = false;
        rowTop.Cells[3].AddParagraph("Rujukan:");
        rowTop.Cells[3].Borders.Left.Visible   = false;
        rowTop.Cells[3].Borders.Right.Visible  = false;
        rowTop.Cells[3].Borders.Bottom.Visible = false;
        rowTop.Cells[4].AddParagraph(oModExpenses.GetSetremarks);
        rowTop.Cells[4].Borders.Left.Visible   = false;
        rowTop.Cells[4].Borders.Right.Visible  = false;
        rowTop.Cells[4].Borders.Bottom.Visible = false;

        // Create the item table
        MigraDoc.DocumentObjectModel.Tables.Table table = section.AddTable();
        table.Style               = "Table";
        table.Borders.Color       = MigraDoc.DocumentObjectModel.Colors.Blue;
        table.Borders.Width       = 0.25;
        table.Borders.Left.Width  = 0.5;
        table.Borders.Right.Width = 0.5;
        table.Rows.LeftIndent     = 0;

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

        column.Format.Alignment = ParagraphAlignment.Center;

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

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

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

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

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

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

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

        row.HeadingFormat    = true;
        row.Format.Alignment = ParagraphAlignment.Center;
        row.Format.Font.Bold = true;
        row.Height           = "1cm";
        row.Shading.Color    = MigraDoc.DocumentObjectModel.Colors.LightGray;
        row.Cells[0].AddParagraph("KETERANGAN ITEM");
        row.Cells[0].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[0].VerticalAlignment = VerticalAlignment.Center;
        row.Cells[0].MergeRight        = 2;
        row.Cells[3].AddParagraph("QTY");
        row.Cells[3].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[3].VerticalAlignment = VerticalAlignment.Center;
        row.Cells[4].AddParagraph("HARGA");
        row.Cells[4].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[4].VerticalAlignment = VerticalAlignment.Center;
        row.Cells[5].AddParagraph("TAX");
        row.Cells[5].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[5].VerticalAlignment = VerticalAlignment.Center;
        row.Cells[6].AddParagraph("JUMLAH");
        row.Cells[6].Format.Alignment  = ParagraphAlignment.Center;
        row.Cells[6].VerticalAlignment = VerticalAlignment.Center;

        for (int i = 0; i < lsExpensesLineItem.Count; i++)
        {
            MainModel modExpDet = (MainModel)lsExpensesLineItem[i];

            // Each item fills two rows
            Row row1 = table.AddRow();
            row1.Height     = "1cm";
            row1.TopPadding = 1.5;
            //row1.Cells[0].VerticalAlignment = VerticalAlignment.Center;
            row1.Cells[0].Format.Alignment = ParagraphAlignment.Center;
            row1.Cells[1].Format.Alignment = ParagraphAlignment.Left;
            row1.Cells[2].Format.Alignment = ParagraphAlignment.Left;
            row1.Cells[3].Format.Alignment = ParagraphAlignment.Center;
            row1.Cells[4].Format.Alignment = ParagraphAlignment.Right;
            row1.Cells[5].Format.Alignment = ParagraphAlignment.Right;
            row1.Cells[6].Format.Alignment = ParagraphAlignment.Right;

            row1.Cells[0].AddParagraph((i + 1).ToString());
            if (oModExpenses.GetSetexpensescat.Equals("PAYMENT_VOUCHER"))
            {
                row1.Cells[1].AddParagraph(oMainCon.getParamDetails("000", modExpDet.GetSetitemno, oModExpenses.GetSetexpensestype, "").GetSetparamdesc);
            }
            else
            {
                row1.Cells[1].AddParagraph(modExpDet.GetSetitemno);
            }
            row1.Cells[2].AddParagraph(modExpDet.GetSetitemdesc);
            row1.Cells[3].AddParagraph(modExpDet.GetSetquantity.ToString());
            row1.Cells[4].AddParagraph(modExpDet.GetSetexpensesprice.ToString("#,##0.00"));
            row1.Cells[5].AddParagraph(modExpDet.GetSettaxamount.ToString("#,##0.00"));
            row1.Cells[6].AddParagraph(modExpDet.GetSettotalexpenses.ToString("#,##0.00"));

            if (i > 0 && ((i + 1) % 10) == 0)
            {
                row1.Cells[0].Borders.Bottom.Visible = true;
                row1.Cells[1].Borders.Bottom.Visible = true;
                row1.Cells[2].Borders.Bottom.Visible = true;
                row1.Cells[3].Borders.Bottom.Visible = true;
                row1.Cells[4].Borders.Bottom.Visible = true;
                row1.Cells[5].Borders.Bottom.Visible = true;
                row1.Cells[6].Borders.Bottom.Visible = true;
            }
            else
            {
                row1.Cells[0].Borders.Bottom.Visible = false;
                row1.Cells[1].Borders.Bottom.Visible = false;
                row1.Cells[2].Borders.Bottom.Visible = false;
                row1.Cells[3].Borders.Bottom.Visible = false;
                row1.Cells[4].Borders.Bottom.Visible = false;
                row1.Cells[5].Borders.Bottom.Visible = false;
                row1.Cells[6].Borders.Bottom.Visible = false;
            }
        }
        if ((lsExpensesLineItem.Count % 10) > 0)
        {
            int totalremainingrow = 10 - (lsExpensesLineItem.Count % 10);
            for (int j = 0; j < totalremainingrow; j++)
            {
                Row rowRemain = table.AddRow();
                rowRemain.Height = "1cm";
                rowRemain.Cells[0].AddParagraph();
                rowRemain.Cells[1].AddParagraph();
                rowRemain.Cells[2].AddParagraph();
                rowRemain.Cells[3].AddParagraph();
                rowRemain.Cells[4].AddParagraph();
                rowRemain.Cells[5].AddParagraph();
                rowRemain.Cells[6].AddParagraph();

                if (j == (totalremainingrow - 1))
                {
                    rowRemain.Cells[0].Borders.Bottom.Visible = true;
                    rowRemain.Cells[1].Borders.Bottom.Visible = true;
                    rowRemain.Cells[2].Borders.Bottom.Visible = true;
                    rowRemain.Cells[3].Borders.Bottom.Visible = true;
                    rowRemain.Cells[4].Borders.Bottom.Visible = true;
                    rowRemain.Cells[5].Borders.Bottom.Visible = true;
                    rowRemain.Cells[6].Borders.Bottom.Visible = true;
                }
                else if (j > 0 && (j % (totalremainingrow - 1)) == 0)
                {
                    rowRemain.Cells[0].Borders.Bottom.Visible = true;
                    rowRemain.Cells[1].Borders.Bottom.Visible = true;
                    rowRemain.Cells[2].Borders.Bottom.Visible = true;
                    rowRemain.Cells[3].Borders.Bottom.Visible = true;
                    rowRemain.Cells[4].Borders.Bottom.Visible = true;
                    rowRemain.Cells[5].Borders.Bottom.Visible = true;
                    rowRemain.Cells[6].Borders.Bottom.Visible = true;
                }
                else
                {
                    rowRemain.Cells[0].Borders.Bottom.Visible = false;
                    rowRemain.Cells[1].Borders.Bottom.Visible = false;
                    rowRemain.Cells[2].Borders.Bottom.Visible = false;
                    rowRemain.Cells[3].Borders.Bottom.Visible = false;
                    rowRemain.Cells[4].Borders.Bottom.Visible = false;
                    rowRemain.Cells[5].Borders.Bottom.Visible = false;
                    rowRemain.Cells[6].Borders.Bottom.Visible = false;
                }
            }
        }

        Row rowTot = table.AddRow();

        rowTot.Height           = "1cm";
        rowTot.Format.Font.Bold = true;
        rowTot.Cells[0].AddParagraph("Catatan:");
        rowTot.Cells[0].Format.Alignment  = ParagraphAlignment.Left;
        rowTot.Cells[0].VerticalAlignment = VerticalAlignment.Top;
        rowTot.Cells[0].MergeRight        = 2;

        rowTot.Cells[3].AddParagraph("JUMLAH BESAR");
        rowTot.Cells[3].Format.Alignment  = ParagraphAlignment.Right;
        rowTot.Cells[3].VerticalAlignment = VerticalAlignment.Center;
        rowTot.Cells[3].MergeRight        = 2;

        rowTot.Cells[6].AddParagraph(oModExpenses.GetSettotalamount.ToString("#,##0.00"));
        rowTot.Cells[6].Format.Alignment  = ParagraphAlignment.Right;
        rowTot.Cells[6].VerticalAlignment = VerticalAlignment.Center;

        //footer.AddText("Footer");
        //footer.Format.Font.Size = 9;
        //footer.Format.Alignment = ParagraphAlignment.Center;

        // Create the item table for footer
        //MigraDoc.DocumentObjectModel.Tables.Table tblBtm = section.Headers.Primary.AddImage(logo_lima);
        MigraDoc.DocumentObjectModel.Tables.Table tblBtm = section.Footers.Primary.AddTable();
        //MigraDoc.DocumentObjectModel.Tables.Table tblBtm = section.AddTable();
        tblBtm.Style               = "Table";
        tblBtm.Borders.Color       = MigraDoc.DocumentObjectModel.Colors.Blue;
        tblBtm.Borders.Width       = 0.25;
        tblBtm.Borders.Left.Width  = 0.5;
        tblBtm.Borders.Right.Width = 0.5;
        tblBtm.Rows.LeftIndent     = 0;

        // Before you can add a row, you must define the columns
        Column colTblBtm = tblBtm.AddColumn("6cm");

        colTblBtm.Format.Alignment = ParagraphAlignment.Left;
        colTblBtm = tblBtm.AddColumn("6cm");
        colTblBtm.Format.Alignment = ParagraphAlignment.Left;
        colTblBtm = tblBtm.AddColumn("6cm");
        colTblBtm.Format.Alignment = ParagraphAlignment.Left;

        Row rowTblBtm = tblBtm.AddRow();

        rowTblBtm.Borders.Left.Visible  = false;
        rowTblBtm.Borders.Right.Visible = false;
        rowTblBtm.Borders.Top.Visible   = false;
        //rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph();
        rowTblBtm.Cells[1].AddParagraph();
        rowTblBtm.Cells[2].AddParagraph();

        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Format.Font.Bold = true;
        rowTblBtm.Height           = "1cm";
        rowTblBtm.Shading.Color    = MigraDoc.DocumentObjectModel.Colors.Gray;
        rowTblBtm.Cells[0].AddParagraph("Disediakan Oleh:");
        rowTblBtm.Cells[0].Format.Alignment  = ParagraphAlignment.Left;
        rowTblBtm.Cells[0].VerticalAlignment = VerticalAlignment.Center;
        rowTblBtm.Cells[1].AddParagraph("Disemak Oleh:");
        rowTblBtm.Cells[1].Format.Alignment  = ParagraphAlignment.Left;
        rowTblBtm.Cells[1].VerticalAlignment = VerticalAlignment.Center;
        rowTblBtm.Cells[2].AddParagraph("Diluluskan Oleh:");
        rowTblBtm.Cells[2].Format.Alignment  = ParagraphAlignment.Left;
        rowTblBtm.Cells[2].VerticalAlignment = VerticalAlignment.Center;
        //rowTblBtm.Cells[2].Borders.Left.Visible = false;
        //rowTblBtm.Cells[2].Borders.Right.Visible = false;
        //rowTblBtm.Cells[2].Borders.Top.Visible = false;
        //rowTblBtm.Cells[2].Borders.Bottom.Visible = false;
        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph();
        rowTblBtm.Cells[1].AddParagraph();
        rowTblBtm.Cells[2].AddParagraph();
        //rowTblBtm.Cells[2].Borders.Left.Visible = false;
        //rowTblBtm.Cells[2].Borders.Right.Visible = false;
        //rowTblBtm.Cells[2].Borders.Top.Visible = false;
        //rowTblBtm.Cells[2].Borders.Bottom.Visible = false;
        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Bottom.Visible = false;
        //rowTblBtm.Cells[2].Borders.Left.Visible = false;
        //rowTblBtm.Cells[2].Borders.Right.Visible = false;
        //rowTblBtm.Cells[2].Borders.Top.Visible = false;
        //rowTblBtm.Cells[2].Borders.Bottom.Visible = false;
        rowTblBtm.Height = "2cm";
        rowTblBtm        = tblBtm.AddRow();
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph("Nama:");
        rowTblBtm.Cells[1].AddParagraph("Nama:");
        rowTblBtm.Cells[2].AddParagraph("Nama:");
        //rowTblBtm.Cells[2].Borders.Left.Visible = false;
        //rowTblBtm.Cells[2].Borders.Right.Visible = false;
        //rowTblBtm.Cells[2].Borders.Top.Visible = false;
        //rowTblBtm.Cells[2].Borders.Bottom.Visible = false;
        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Borders.Bottom.Visible = false;
        rowTblBtm.Cells[0].AddParagraph("Jawatan:");
        rowTblBtm.Cells[1].AddParagraph("Jawatan:");
        rowTblBtm.Cells[2].AddParagraph("Jawatan:");
        //rowTblBtm.Cells[2].Borders.Left.Visible = false;
        //rowTblBtm.Cells[2].Borders.Right.Visible = false;
        //rowTblBtm.Cells[2].Borders.Top.Visible = false;
        //rowTblBtm.Cells[2].Borders.Bottom.Visible = false;
        rowTblBtm = tblBtm.AddRow();
        rowTblBtm.Cells[0].AddParagraph("Tarikh:");
        rowTblBtm.Cells[1].AddParagraph("Tarikh:");
        rowTblBtm.Cells[2].AddParagraph("Tarikh:");
        //rowTblBtm.Cells[2].Borders.Left.Visible = false;
        //rowTblBtm.Cells[2].Borders.Right.Visible = false;
        //rowTblBtm.Cells[2].Borders.Top.Visible = false;
        //rowTblBtm.Cells[2].Borders.Bottom.Visible = false;

        // Create a renderer for PDF that uses Unicode font encoding
        PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true);

        // Set the MigraDoc document
        pdfRenderer.Document = doc;

        // Create the PDF document
        pdfRenderer.RenderDocument();

        // Save the document...
        string pdfFilename = sExpensesNo + ".pdf";
        string file        = Server.MapPath("~/App_Data/" + pdfFilename);
        //string file = HttpContext.Current.Server.MapPath("~/pdf/" + pdfFilename);
        //string file = "C:/TEMP/" + pdfFilename;

        // ...and start a viewer //
        //pdfRenderer.Save(file);
        //Process.Start(file);

        // Send PDF to browser //
        MemoryStream stream = new MemoryStream();

        pdfRenderer.Save(stream, false);
        Response.Clear();
        Response.ContentType = "application/pdf";
        Response.AddHeader("content-length", stream.Length.ToString());
        Response.BinaryWrite(stream.ToArray());
        Response.Flush();
        stream.Close();
        Response.End();

        //download file //
        //Response.ContentType = "Application/pdf";
        //Response.AppendHeader("Content-Disposition", "attachment; filename=" + pdfFilename);
        //Response.TransmitFile(file);
        //Response.End();
    }
Beispiel #37
0
        /// <summary>
        /// Parses the keyword «\columns».
        /// </summary>
        private void ParseColumns(Table table)
        {
            Debug.Assert(table != null);
            Debug.Assert(Symbol == Symbol.Columns);

            ReadCode();
            if (Symbol == Symbol.BracketLeft)
                ParseAttributes(table.Columns);

            AssertSymbol(Symbol.BraceLeft);
            ReadCode();

            bool loop = true;
            while (loop)
            {
                switch (Symbol)
                {
                    case Symbol.Eof:
                        ThrowParserException(DomMsgID.UnexpectedEndOfFile);
                        break;

                    case Symbol.BraceRight:
                        loop = false;
                        ReadCode();
                        break;

                    case Symbol.Column:
                        ParseColumn(table.AddColumn());
                        break;

                    default:
                        AssertSymbol(Symbol.Column);
                        break;
                }
            }
        }
        static void exportPDF(List<string> students, List<string> info, List<string> rubrik)
        {
            SaveFileDialog saveFile = new SaveFileDialog();
            saveFile.Filter = "PDF File (*.pdf|*.pdf";

            if (saveFile.ShowDialog() != DialogResult.OK)
                return;

            Document doc = new Document();

            string assignmentName = info[0];
            string courseCode = info[1];
            string prof = info[2];
            string ta = info[3];

            //MetaData
            doc.Info.Title = assignmentName + " Cover Page Print-Outs " + courseCode;
            doc.Info.Author = "Tyler Wilding";

            //Document Styles
            Style style = doc.Styles["Normal"];
            style.Font.Name = "Segoe UI";
            style.Font.Size = 12;

            style = doc.Styles["Heading1"];
            style.Font.Name = "Segoe UI";
            style.Font.Size = 24;
            style.Font.Color = Colors.Black;
            style.Font.Bold = true;

            style = doc.Styles["Heading2"];
            style.Font.Name = "Segoe UI";
            style.Font.Size = 18;
            style.Font.Color = Colors.DarkMagenta;

            style = doc.Styles.AddStyle("Small", "Normal");
            style.Font.Name = "Segoe UI";
            style.Font.Size = 10;
            style.Font.Color = Colors.Black;
            style.Font.Italic = true;

            foreach (string student in students) {

                //Front Cover
                Section section = doc.AddSection();
                Paragraph paragraph = section.AddParagraph(student);
                paragraph.Format.SpaceAfter = "3.5cm";
                paragraph.Format.Alignment = ParagraphAlignment.Center;
                paragraph.Style = "Heading1";

                paragraph = section.AddParagraph(courseCode);
                paragraph.Format.SpaceAfter = "2.5cm";
                paragraph.Format.Alignment = ParagraphAlignment.Center;
                paragraph.Style = "Heading2";

                paragraph = section.AddParagraph(assignmentName);
                paragraph.Format.SpaceAfter = "2.5cm";
                paragraph.Format.Alignment = ParagraphAlignment.Center;
                paragraph.Style = "Heading2";

                paragraph = section.AddParagraph("Professor: " + prof);
                paragraph.Format.SpaceAfter = "2.5cm";
                paragraph.Format.Alignment = ParagraphAlignment.Center;
                paragraph.Style = "Heading2";

                paragraph = section.AddParagraph("Teaching Assistant: " + ta);
                paragraph.Format.SpaceAfter = "2.5cm";
                paragraph.Format.Alignment = ParagraphAlignment.Center;
                paragraph.Style = "Heading2";

                section.AddPageBreak();

                //Marking Breakdown
                paragraph = section.AddParagraph("Marking Breakdown");
                paragraph.Format.Alignment = ParagraphAlignment.Center;
                paragraph.Format.SpaceAfter = "0.25cm";
                paragraph.Style = "Heading2";

                Table table = new Table();
                table.Rows.Alignment = RowAlignment.Center;
                table.Borders.Width = 0.75;

                table.AddColumn(Unit.FromCentimeter(8));

                Column column = table.AddColumn(Unit.FromCentimeter(2));
                column.Format.Alignment = ParagraphAlignment.Right;

                Row row = table.AddRow();
                row.Shading.Color = Colors.PaleGreen;
                row.Style = "Normal";
                Cell cell = row.Cells[0];
                paragraph = section.AddParagraph();
                cell.AddParagraph("Programming Questions");
                cell = row.Cells[1];
                cell.AddParagraph(rubrik[0] + "%");

                row = table.AddRow();
                row.Shading.Color = Colors.PaleGreen;
                row.Style = "Normal";
                cell = row.Cells[0];
                cell.AddParagraph("Demonstration");
                cell = row.Cells[1];
                cell.AddParagraph(rubrik[1] + "%");

                row = table.AddRow();
                row.Shading.Color = Colors.PaleVioletRed;
                row.Style = "Normal";
                cell = row.Cells[0];
                cell.AddParagraph("Comment Deduction");
                cell = row.Cells[1];
                cell.AddParagraph(rubrik[2] + "%");

                row = table.AddRow();
                row.Shading.Color = Colors.PaleVioletRed;
                row.Style = "Normal";
                cell = row.Cells[0];
                cell.AddParagraph("Formatting Deduction");
                cell = row.Cells[1];
                cell.AddParagraph(rubrik[3] + "%");

                row = table.AddRow();
                row.Shading.Color = Colors.PaleVioletRed;
                row.Style = "Normal";
                cell = row.Cells[0];
                cell.AddParagraph("Late Penalty");
                cell = row.Cells[1];
                cell.AddParagraph(rubrik[4] + "%");

                table.SetEdge(0, 0, 2, 3, Edge.Box, MigraDoc.DocumentObjectModel.BorderStyle.Single, 1.5, Colors.Black);
                table.Format.SpaceAfter = "1.5cm";

                section.Add(table);

                //Programming Problems
                paragraph = section.AddParagraph("Programming Problems");
                paragraph.Style = "Heading1";
                paragraph.Format.SpaceAfter = "0.25cm";

                for(int i = 5; i < rubrik.Count; i+=2) {

                    paragraph = section.AddParagraph(rubrik[i]+" (\t\t/"+rubrik[i+1]+")");
                    paragraph.Style = "Heading2";
                    paragraph.Format.LeftIndent = "1cm";

                    paragraph = section.AddParagraph("Notes: ");
                    paragraph.Style = "Normal";
                    paragraph.Format.SpaceAfter = "1cm";
                    paragraph.Format.LeftIndent = "2cm";
                }

                paragraph = section.AddParagraph("Demonstration " + "(\t\t/" + rubrik[1]+")");
                paragraph.Format.Alignment = ParagraphAlignment.Left;
                paragraph.Style = "Heading1";

                paragraph = section.AddParagraph("Notes: ");
                paragraph.Style = "Normal";
                paragraph.Format.SpaceAfter = "2cm";
                paragraph.Format.LeftIndent = "1cm";

                paragraph = section.AddParagraph("Comment Deduction " + "(\t\t/" + rubrik[2] + ")");
                paragraph.Format.Alignment = ParagraphAlignment.Left;
                paragraph.Style = "Heading1";

                paragraph = section.AddParagraph("Notes: ");
                paragraph.Style = "Normal";
                paragraph.Format.SpaceAfter = "2cm";
                paragraph.Format.LeftIndent = "1cm";

                paragraph = section.AddParagraph("Formatting Deduction " + "(\t\t/" + rubrik[3] + ")");
                paragraph.Format.Alignment = ParagraphAlignment.Left;
                paragraph.Style = "Heading1";

                paragraph = section.AddParagraph("Notes: ");
                paragraph.Style = "Normal";
                paragraph.Format.SpaceAfter = "2cm";
                paragraph.Format.LeftIndent = "1cm";
            }

            //Setting Up Exporting
            MigraDoc.DocumentObjectModel.IO.DdlWriter.WriteToFile(doc, "MigraDoc.mddd1");
            PdfDocumentRenderer renderer = new PdfDocumentRenderer(true, PdfSharp.Pdf.PdfFontEmbedding.Always);
            renderer.Document = doc;
            renderer.RenderDocument();

            //Name of document
            string filename = saveFile.FileName;
            renderer.PdfDocument.Save(filename);
            Process.Start(filename);
        }
        private static void CreateMicTable(Document doc, SetItem itemSet, Section section, out Table table, out Row row, out Cell cell)
        {
            table = new Table();
            table.Borders.Width = "0.015cm";

            int i = 0;
            int cntr = 0;

            //Add CEll, Number, MusNumber, Organism to table
            //CEll
            var column = table.AddColumn("0.8cm");
            column.Format.Alignment = ParagraphAlignment.Center;
            // MusNumber
            column = table.AddColumn("2cm");
            column.Format.Alignment = ParagraphAlignment.Center;
            // Organism
            column = table.AddColumn("1.8cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            // Mic
            var micCount = itemSet.MICList.Count;
            double micWidth = ((doc.DefaultPageSetup.PageWidth.Centimeter - 5.5*(section.PageSetup.LeftMargin.Centimeter + section.PageSetup.RightMargin.Centimeter) )
                / micCount);

            for (int j = 0; j < micCount ; j++)
            {
                column = table.AddColumn(micWidth.ToString() + "cm");
                column.Format.Alignment = ParagraphAlignment.Center;
            }

            // Total Mic
            column = table.AddColumn("1.8cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            //Add header row
            row = table.AddRow();

            row.Height = "0.4cm";
            row.HeadingFormat = true;
            row.Borders.Bottom.Width = "0.05cm";

            cell = row.Cells[0];
            cell.AddParagraph("Ячейка");
            cell.VerticalAlignment = VerticalAlignment.Center;

            cell = row.Cells[1];
            cell.AddParagraph("Муз.№");
            cell.VerticalAlignment = VerticalAlignment.Center;

            cell = row.Cells[2];
            cell.AddParagraph("МО");
            cell.VerticalAlignment = VerticalAlignment.Center;

            for (int j = 0; j < micCount ; j++)
            {
                cell = row.Cells[3 + j];
                cell.VerticalAlignment = VerticalAlignment.Center;
                cell.AddParagraph(itemSet.MICList[j].ToString());
            }

            cell = row.Cells[3 + micCount];
            cell.VerticalAlignment = VerticalAlignment.Center;
            cell.AddParagraph("МПК");
        }
        private static void SimpleTable(Document document, QueryData data)
        {
            document.LastSection.AddParagraph("Описание: " + data.Description, "Heading2");

            Table table = new Table();
            table.Borders.Width = 0.75;

            Row row ;
            Cell cell;
            int i = 0;
            int cntr = 0;

            foreach (var strFieldName in data.FieldsName)
            {
            var column = table.AddColumn();
                column.Format.Alignment = ParagraphAlignment.Center;
                column.Width = (document.DefaultPageSetup.PageWidth - document.DefaultPageSetup.RightMargin - document.DefaultPageSetup.LeftMargin)/data.FieldsName.Count;

            }

            row = table.AddRow();
            row.Shading.Color = Colors.PaleGoldenrod;
            row.HeadingFormat = true;

            foreach (var strFieldName in data.FieldsName)
            {

                cell = row.Cells[i];
                cell.AddParagraph(strFieldName);
                i++;
            }
            for ( i = 0; i < data.Data.Rows.Count; i++)
            {
                cntr++;

                row = table.AddRow();
                if (cntr % 2 == 0)
                {
                    row.Shading.Color = Colors.LightGray;
                }
                for (int j = 0; j < data.FieldsName.Count; j++)
                {

                    cell = row.Cells[j];
                    cell.AddParagraph(data.Data.Rows[i][j].ToString());
                    cell.Format.Font.Size = 8;

                }
            }

               table.SetEdge(0, 0, data.FieldsName.Count, data.Data.Rows.Count, Edge.Box, BorderStyle.Single, 1.5, Colors.Black);

            document.LastSection.Add(table);
        }
Beispiel #41
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());
        }
Beispiel #42
0
    public static void DemonstrateSimpleTable(Document document)
    {
        var table = new Table();
        table.Borders.Width = 0.25;

        Column column = table.AddColumn(Unit.FromCentimeter(2));
        column.Format.Alignment = ParagraphAlignment.Center;

        table.AddColumn(Unit.FromCentimeter(2));
        table.AddColumn(Unit.FromCentimeter(4));
        table.AddColumn(Unit.FromCentimeter(4));
        table.AddColumn(Unit.FromCentimeter(2));
        table.AddColumn(Unit.FromCentimeter(2));
        table.AddColumn(Unit.FromCentimeter(2));

        Row row = table.AddRow();
        row.Shading.Color = Colors.PaleGoldenrod;
        Cell cell = row.Cells[0];
        cell.AddParagraph("Status");
        cell = row.Cells[1];
        cell.AddParagraph("Category");
        cell = row.Cells[2];
        cell.AddParagraph("Title");
        cell = row.Cells[3];
        cell.AddParagraph("Description");
        cell = row.Cells[4];
        cell.AddParagraph("Creator Name");
        cell = row.Cells[5];
        cell.AddParagraph("Size");
        cell = row.Cells[6];
        cell.AddParagraph("Download Date");
        var rowCount = 0;
        try
        {
            using (var conn = new MySqlConnection(ConfigurationManager.ConnectionStrings["oktrackerConnectionString"].ConnectionString))
            {
                conn.Open();
                var command = conn.CreateCommand();
                command.CommandType = CommandType.StoredProcedure;
                command.CommandText = "history_of_user";
                command.Parameters.Add(new MySqlParameter("p_user_id", MySqlDbType.Int32));
                command.Parameters["p_user_id"].Value = (int) HttpContext.Current.Session["uid"];
                using (var reader = command.ExecuteReader())
                {
                    while (reader.Read())
                    {
                        row = table.AddRow();
                        cell = row.Cells[0];
                        cell.AddParagraph(reader.GetString("status_name"));
                        cell = row.Cells[1];
                        cell.AddParagraph(reader.GetString("category_name"));
                        cell = row.Cells[2];
                        cell.AddParagraph(reader.GetString("release_title"));
                        cell = row.Cells[3];
                        cell.AddParagraph(reader.GetString("release_description"));
                        cell = row.Cells[4];
                        cell.AddParagraph(reader.GetString("user_name"));
                        cell = row.Cells[5];
                        cell.AddParagraph(reader.GetInt64("size").ToString());
                        cell = row.Cells[6];
                        cell.AddParagraph(reader.GetDateTime("download_date").ToString());
                        rowCount++;
                    }
                }
                conn.Close();
            }
        }
        catch (Exception exception)
        {
        }
        table.SetEdge(0, 0, 7, rowCount, Edge.Box, BorderStyle.Single, 1.5, Colors.Black);

        document.LastSection.Add(table);
    }
Beispiel #43
0
        private Table SetUpKampftabelle(double randLinksRechts)
        {
            Table table = new Table();

            table.Style               = CustomStyles.TABLE;
            table.Borders.Color       = Colors.Black;
            table.Borders.Width       = 0.25;
            table.Borders.Left.Width  = 0.25;
            table.Borders.Right.Width = 0.25;
            table.Rows.LeftIndent     = 0;

            // Before you can add a row, you must define the columns
            double a4LandscapeBreite = (29.7 - 2 * randLinksRechts);

            double breite_KampfNr        = 0.7;
            double breite_Stilart        = 1.5;
            double breite_Gewichtsklasse = 1.0;
            double breite_IstGewicht     = 1.1;
            double breite_PassNr         = 1.1;
            double breite_Status         = 1.2;
            double breite_Punkte         = 1.0;
            double breite_Siegart        = 2.8;
            double breite_Wertungen      = 3.2;

            double nochUebrig = a4LandscapeBreite - breite_KampfNr - breite_Stilart - breite_Gewichtsklasse - 2 * breite_IstGewicht -
                                2 * breite_PassNr - 2 * breite_Status - 2 * breite_Punkte - breite_Siegart - breite_Wertungen;
            double breite_Name = nochUebrig / 2;

            Column column = table.AddColumn($"{breite_KampfNr}cm");

            column.Format.Alignment = ParagraphAlignment.Right;
            column = table.AddColumn($"{breite_Stilart}cm");
            column.Format.Alignment = ParagraphAlignment.Left;
            column = table.AddColumn($"{breite_Gewichtsklasse}cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = table.AddColumn($"{breite_IstGewicht}cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = table.AddColumn($"{breite_Name}cm");
            column.Format.Alignment = ParagraphAlignment.Left;

            column = table.AddColumn($"{breite_PassNr}cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = table.AddColumn($"{breite_Status}cm");
            column.Format.Alignment = ParagraphAlignment.Center;

            column = table.AddColumn($"{breite_Punkte}cm");
            column.Format.Alignment = ParagraphAlignment.Center;
            column.Format.Font.Bold = true;

            column = table.AddColumn($"{breite_IstGewicht}cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = table.AddColumn($"{breite_Name}cm");
            column.Format.Alignment = ParagraphAlignment.Left;

            column = table.AddColumn($"{breite_PassNr}cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = table.AddColumn($"{breite_Status}cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = table.AddColumn($"{breite_Punkte}cm");
            column.Format.Alignment = ParagraphAlignment.Center;
            column.Format.Font.Bold = true;

            column = table.AddColumn($"{breite_Siegart}cm");
            column.Format.Alignment = ParagraphAlignment.Right;

            column = table.AddColumn($"{breite_Wertungen}cm");
            column.Format.Alignment = ParagraphAlignment.Left;

            return(table);
        }
Beispiel #44
0
 public static void DrawGrid(Section section,ODGrid grid)
 {
     //first, calculate width of dummy column that will push the grid over just enough to center it on the page.
     double pageW=0;
     if(CultureInfo.CurrentCulture.Name=="en-US") {
         pageW=850;
     }
     //don't know about Canada
     else {
         pageW=830;
     }
     //in 100ths/inch
     double widthAllColumns=(double)grid.WidthAllColumns/.96;
     double lmargin=section.Document.DefaultPageSetup.LeftMargin.Inch*100;
     double dummyColW=(pageW-widthAllColumns)/2-lmargin;
     Table table=new Table();
     Column col;
     col=table.AddColumn(Unit.FromInch(dummyColW/100));
     for(int i=0;i<grid.Columns.Count;i++){
         col=table.AddColumn(Unit.FromInch((double)grid.Columns[i].ColWidth/96));
         col.LeftPadding=Unit.FromInch(.01);
         col.RightPadding=Unit.FromInch(.01);
     }
     Row row;
     row=table.AddRow();
     row.HeadingFormat=true;
     row.TopPadding=Unit.FromInch(0);
     row.BottomPadding=Unit.FromInch(-.01);
     Cell cell;
     Paragraph par;
     //dummy column:
     cell=row.Cells[0];
     //cell.Shading.Color=Colors.LightGray;
     //format dummy cell?
     MigraDoc.DocumentObjectModel.Font fontHead=new MigraDoc.DocumentObjectModel.Font("Arial",Unit.FromPoint(8.5));
     fontHead.Bold=true;
     for(int i=0;i<grid.Columns.Count;i++){
         cell = row.Cells[i+1];
         par=cell.AddParagraph();
         par.AddFormattedText(grid.Columns[i].Heading,fontHead);
         par.Format.Alignment=ParagraphAlignment.Center;
         cell.Format.Alignment=ParagraphAlignment.Center;
         cell.Borders.Width=Unit.FromPoint(1);
         cell.Borders.Color=Colors.Black;
         cell.Shading.Color=Colors.LightGray;
     }
     MigraDoc.DocumentObjectModel.Font fontBody=null;//=new MigraDoc.DocumentObjectModel.Font("Arial",Unit.FromPoint(8.5));
     bool isBold;
     System.Drawing.Color color;
     int edgeRows=1;
     for(int i=0;i<grid.Rows.Count;i++,edgeRows++){
         row=table.AddRow();
         row.TopPadding=Unit.FromInch(.01);
         row.BottomPadding=Unit.FromInch(0);
         for(int j=0;j<grid.Columns.Count;j++){
             cell = row.Cells[j+1];
             par=cell.AddParagraph();
             if(grid.Rows[i].Cells[j].Bold==YN.Unknown){
                 isBold=grid.Rows[i].Bold;
             }
             else if(grid.Rows[i].Cells[j].Bold==YN.Yes){
                 isBold=true;
             }
             else{// if(grid.Rows[i].Cells[j].Bold==YN.No){
                 isBold=false;
             }
             if(grid.Rows[i].Cells[j].ColorText==System.Drawing.Color.Empty){
                 color=grid.Rows[i].ColorText;
             }
             else{
                 color=grid.Rows[i].Cells[j].ColorText;
             }
             fontBody=CreateFont(8.5f,isBold,color);
             par.AddFormattedText(grid.Rows[i].Cells[j].Text,fontBody);
             if(grid.Columns[j].TextAlign==HorizontalAlignment.Center){
                 cell.Format.Alignment=ParagraphAlignment.Center;
             }
             if(grid.Columns[j].TextAlign==HorizontalAlignment.Left) {
                 cell.Format.Alignment=ParagraphAlignment.Left;
             }
             if(grid.Columns[j].TextAlign==HorizontalAlignment.Right) {
                 cell.Format.Alignment=ParagraphAlignment.Right;
             }
             cell.Borders.Color=new MigraDoc.DocumentObjectModel.Color(180,180,180);
             if(grid.Rows[i].ColorLborder!=System.Drawing.Color.Empty){
                 cell.Borders.Bottom.Color=ConvertColor(grid.Rows[i].ColorLborder);
             }
         }
         if(grid.Rows[i].Note!=null && grid.Rows[i].Note!="" && grid.NoteSpanStop>0 && grid.NoteSpanStart<grid.Columns.Count){
             row=table.AddRow();
             row.TopPadding=Unit.FromInch(.01);
             row.BottomPadding=Unit.FromInch(0);
             cell=row.Cells[grid.NoteSpanStart+1];
             par=cell.AddParagraph();
           par.AddFormattedText(grid.Rows[i].Note,fontBody);
           cell.Format.Alignment=ParagraphAlignment.Left;
             cell.Borders.Color=new MigraDoc.DocumentObjectModel.Color(180,180,180);
             cell.MergeRight=grid.Columns.Count-1-grid.NoteSpanStart;
             edgeRows++;
         }
     }
     table.SetEdge(1,0,grid.Columns.Count,edgeRows,Edge.Box,MigraDoc.DocumentObjectModel.BorderStyle.Single,1,Colors.Black);
     section.Add(table);
 }
Beispiel #45
0
        /// <summary>
        /// Write the specified table to the TextWriter.
        /// </summary>
        /// <param name="writer">The writer to write to</param>
        /// <param name="table">The table to write</param>
        /// <param name="outtype">Indicates the format to be produced</param>
        /// <param name="className">The class name of the generated html table</param>
        /// <param name="document">Document object if using MigraDoc to generate output, null otherwise </param>
        private static void WriteTable(TextWriter writer, DataTable table, OutputType outtype, string className, Document document)
        {
            bool showHeadings = className != "PropertyTable";

            if (outtype == OutputType.html)
            {
                if (showHeadings)
                {
                    writer.WriteLine("<table class='headered'>");
                    writer.Write("<tr>");
                    for (int i = 0; i < table.Columns.Count; i++)
                    {
                        writer.Write("<th");
                        if (i == 0)
                        {
                            writer.Write(" class='col1'");
                        }
                        writer.Write(">" + table.Columns[i].ColumnName + "</th>");
                    }
                }
                else
                {
                    writer.WriteLine("<table>");
                }

                foreach (DataRow row in table.Rows)
                {
                    bool titleRow = Convert.IsDBNull(row[0]);
                    if (titleRow)
                    {
                        writer.Write("<tr class='total'>");
                    }
                    else
                    {
                        writer.Write("<tr>");
                    }

                    for (int i = 0; i < table.Columns.Count; i++)
                    {
                        string st;
                        if (titleRow && i == 0)
                        {
                            st = "Total";
                        }
                        else
                        {
                            st = row[i].ToString();
                        }

                        writer.Write("<td");
                        if (i == 0)
                        {
                            writer.Write(" class='col1'");
                        }
                        writer.Write(">");
                        writer.Write(st);
                        writer.Write("</td>");
                    }
                    writer.WriteLine("</tr>");
                }
                writer.WriteLine("</table><br/>");
            }
            else if (outtype == OutputType.rtf)
            {
                MigraDoc.DocumentObjectModel.Tables.Table tabl = new MigraDoc.DocumentObjectModel.Tables.Table();
                tabl.Borders.Width = 0.75;

                foreach (DataColumn col in table.Columns)
                {
                    Column column = tabl.AddColumn(Unit.FromCentimeter(18.0 / table.Columns.Count));
                }

                if (showHeadings)
                {
                    MigraDoc.DocumentObjectModel.Tables.Row row = tabl.AddRow();
                    row.Shading.Color  = Colors.PaleGoldenrod;
                    tabl.Shading.Color = new Color(245, 245, 255);
                    for (int i = 0; i < table.Columns.Count; i++)
                    {
                        Cell      cell      = row.Cells[i];
                        Paragraph paragraph = cell.AddParagraph();
                        if (i == 0)
                        {
                            paragraph.Format.Alignment = ParagraphAlignment.Left;
                        }
                        else
                        {
                            paragraph.Format.Alignment = ParagraphAlignment.Right;
                        }
                        paragraph.AddText(table.Columns[i].ColumnName);
                    }
                }

                foreach (DataRow row in table.Rows)
                {
                    bool   titleRow = Convert.IsDBNull(row[0]);
                    string st;
                    MigraDoc.DocumentObjectModel.Tables.Row newRow = tabl.AddRow();

                    for (int i = 0; i < table.Columns.Count; i++)
                    {
                        if (titleRow && i == 0)
                        {
                            st = "Total";
                            newRow.Format.Font.Color = Colors.DarkOrange;
                            newRow.Format.Font.Bold  = true;
                        }
                        else
                        {
                            st = row[i].ToString();
                        }

                        Cell      cell      = newRow.Cells[i];
                        Paragraph paragraph = cell.AddParagraph();
                        if (!showHeadings)
                        {
                            cell.Borders.Style         = BorderStyle.None;
                            paragraph.Format.Alignment = ParagraphAlignment.Left;
                        }
                        else if (i == 0)
                        {
                            paragraph.Format.Alignment = ParagraphAlignment.Left;
                        }
                        else
                        {
                            paragraph.Format.Alignment = ParagraphAlignment.Right;
                        }

                        if (showHeadings && i == 0)
                        {
                            paragraph.AddFormattedText(st, TextFormat.Bold);
                        }
                        else
                        {
                            paragraph.AddText(st);
                        }
                    }
                }

                document.LastSection.Add(tabl);
                document.LastSection.AddParagraph(); // Just to give a bit of spacing
            }
            else
            {
                DataTableUtilities.DataTableToText(table, 0, "  ", showHeadings, writer);
            }
        }
        private void createSignoffSection()
        {
            Section currentSection = (Section)serviceSheetDoc.Sections.LastObject;
            signoffTable = currentSection.AddTable();

            //Setup the table columns and borders
            Column tableColumnn = signoffTable.AddColumn(COLUMN_ONE_WIDTH);
            tableColumnn = signoffTable.AddColumn(COLUMN_TWO_WIDTH);
            signoffTable.Borders.Color = tableBorderColour;
            signoffTable.Borders.Width = borderWidth;

            Row row1Title = signoffTable.AddRow();
            row1Title.Cells[0].MergeRight = 1;
            Paragraph signoffPara = row1Title.Cells[0].AddParagraph();
            signoffPara.AddFormattedText("J", "allCapsFirstLetter");
            signoffPara.AddFormattedText("OB ", "allCapsNextLetter");
            signoffPara.AddFormattedText("S", "allCapsFirstLetter");
            signoffPara.AddFormattedText("IGNOFF", "allCapsNextLetter");
            row1Title.Cells[0].Shading.Color = headerGrey;

            row1Title.KeepWith = 6;
            Row row2Title = signoffTable.AddRow();
            row2Title.Cells[0].MergeRight = 1;
            Paragraph signoffParaCertify = row2Title.Cells[0].AddParagraph();
            signoffParaCertify.AddText("I hereby certify that the service work has been carried out to my satisfaction");
            row2Title.Cells[0].Shading.Color = entryHeaderGrey;

            addImageToSignoffTable("Customer signature", currentSheet.CustomerSignature, 2);
            addLineToSignoffTable("Customer name", currentSheet.CustomerName);
            addLineToSignoffTable("Date", currentSheet.DtSigned.ToShortDateString());
            addImageToSignoffTable("MTT engineer signature", currentSheet.MttEngineerSignature, 2);
            addLineToSignoffTable("MTT engineer", currentSheet.EngineerFullName);
        }
        /// <summary>
        /// Creates a new table with the given number of column + column width
        /// </summary>
        /// <param name="columnNames"></param>
        /// <param name="columnWidth"></param>
        public void AddTable(string[] columnNames, int[] columnWidth)
        {
            table = section.AddTable();
            table.Style = "Table";
            table.Borders.Color = Colors.Black;
            table.Borders.Width = 0.25;
            table.Borders.Left.Width = 0.5;
            table.Borders.Right.Width = 0.5;
            table.Rows.LeftIndent = 0;

            Unit totalWidth = 0;
            for (int i = 0; i <= columnWidth.Length - 2; i++)
            {
                Unit colWidth = new Unit(columnWidth[i], UnitType.Millimeter);
                table.AddColumn(colWidth);
                totalWidth += colWidth;
            }
            table.AddColumn(TABLE_WIDTH - totalWidth);

            AddTableHeader(columnNames);
        }
        private void createFollowupSection()
        {
            Section currentSection = (Section)serviceSheetDoc.Sections.LastObject;
            followupTable = currentSection.AddTable();

            //Setup the table columns and borders
            Column tableColumnn = followupTable.AddColumn(COLUMN_ONE_WIDTH);
            tableColumnn = followupTable.AddColumn(COLUMN_TWO_WIDTH);
            followupTable.Borders.Color = tableBorderColour;
            followupTable.Borders.Width = borderWidth;

            Row row1Title = followupTable.AddRow();
            row1Title.Cells[0].MergeRight = 1;
            Paragraph followupPara = row1Title.Cells[0].AddParagraph();
            followupPara.AddFormattedText("F", "allCapsFirstLetter");
            followupPara.AddFormattedText("OLLOW-UP ", "allCapsNextLetter");
            followupPara.AddFormattedText("W", "allCapsFirstLetter");
            followupPara.AddFormattedText("ORK", "allCapsNextLetter");
            row1Title.Cells[0].Shading.Color = headerGrey;

            row1Title.KeepWith = 9;

            addLineToFollowupTable("Additional faults found", currentSheet.AdditionalFaults);
            addLineToFollowupTable("Parts required", currentSheet.FollowUpPartsRequired);
            //RT 18/8/16 - Quote required should be yes/no
            bool quoteRequired = currentSheet.QuoteRequired;
            if (quoteRequired)
            {
                addLineToFollowupTable("Quote required", "Yes");
            }
            else
            {
                addLineToFollowupTable("Quote required", "No");
            }
            //addLineToFollowupTable("Quote required", currentSheet.QuoteRequired.ToString());

            Row rowImages= followupTable.AddRow();
            rowImages.Cells[0].MergeRight = 1;
            Paragraph followupImagesPara = rowImages.Cells[0].AddParagraph();
            followupImagesPara.AddFormattedText("F", "allCapsFirstLetter");
            followupImagesPara.AddFormattedText("OLLOW-UP WORK IMAGES", "allCapsNextLetter");
            rowImages.Cells[0].Shading.Color = headerGrey;

            addImageToFollowupTable("Image 1", currentSheet.Image1, 4);
            addImageToFollowupTable("Image 2", currentSheet.Image2, 4);
            addImageToFollowupTable("Image 3", currentSheet.Image3, 4);
            addImageToFollowupTable("Image 4", currentSheet.Image4, 4);
            addImageToFollowupTable("Image 5", currentSheet.Image5, 4);

            //Add a space before the next table
            currentSection.AddParagraph();
        }
Beispiel #49
0
        public string pdfRapportoAgentePlus(string autore, string emailAutore, string periodoRiferimento, Single acconto, Single recupero, Single daRiportare, Single monete, Single carta, string targa, List <cCostanti.tOperazione> info)
        {
            cCostanti costanti = new cCostanti();
            string    testo = "";
            string    fileName, pathFileName;
            string    pageFooterText = "";

            DateTime  currentTime     = DateTime.Now;
            Document  document        = new Document();
            Table     table           = new MigraDoc.DocumentObjectModel.Tables.Table();
            Paragraph infoPremilinari = new MigraDoc.DocumentObjectModel.Paragraph();
            Column    colonna;

            FormattedText ftextTarga = new FormattedText();

            fileName     = ("pdf_" + emailAutore).Replace(" ", "").Replace(".", "_").Replace("@", "_") + ".pdf";
            pathFileName = HttpContext.Current.Server.MapPath(costanti.pathRemoto + "/" + fileName);

            Style style = document.Styles["Normal"];

            style.Font.Name = "Arial Unicode MS";
            style.Font.Size = 12;
            style.Font.Bold = false;


            //table Style
            style           = document.Styles.AddStyle("tabella", "Normal");
            style.Font.Name = "Verdana";
            style.Font.Size = 12;
            style.Font.Bold = false;

            style           = document.Styles.AddStyle("rigaBold", "Normal");
            style.Font.Name = "Verdana";
            style.Font.Size = 12;
            style.Font.Bold = true;

            style           = document.Styles.AddStyle("riga24", "Normal");
            style.Font.Name = "Verdana";
            style.Font.Size = 24;
            style.Font.Bold = true;

            style           = document.Styles.AddStyle("testoBold", "Normal");
            style.Font.Name = "Verdana";
            style.Font.Size = 12;
            style.Font.Bold = true;

            style            = document.Styles.AddStyle("testoRosso", "Normal");
            style.Font.Name  = "Verdana";
            style.Font.Size  = 14;
            style.Font.Bold  = true;
            style.Font.Color = Colors.OrangeRed;

            style            = document.Styles.AddStyle("testoBlu", "Normal");
            style.Font.Name  = "Verdana";
            style.Font.Size  = 14;
            style.Font.Bold  = true;
            style.Font.Color = Colors.DarkBlue;

            style            = document.Styles.AddStyle("testoLightBlu", "Normal");
            style.Font.Name  = "Verdana";
            style.Font.Size  = 12;
            style.Font.Bold  = false;
            style.Font.Color = Colors.DarkBlue;

            style            = document.Styles.AddStyle("testoNero", "Normal");
            style.Font.Name  = "Verdana";
            style.Font.Size  = 14;
            style.Font.Bold  = true;
            style.Font.Color = Colors.Black;

            style            = document.Styles.AddStyle("Titolo", "Normal");
            style.Font.Name  = "Verdana";
            style.Font.Size  = 16;
            style.Font.Bold  = true;
            style.Font.Color = Colors.Orange;

            Section page = document.AddSection();

            //header
            Paragraph header = page.Headers.Primary.AddParagraph();

            header.AddText("Money BOX");
            header.Format.Alignment = ParagraphAlignment.Left;
            header.Style            = "Titolo";
            testo  = string.Format("{0}, {1}, targa: ", autore, emailAutore);
            header = page.Headers.Primary.AddParagraph();
            header.AddText(testo);
            ftextTarga.AddText(targa.ToUpper());
            ftextTarga.Color = Colors.Red;
            header.Add(ftextTarga);
            header.AddText("\n");
            header.Format.Alignment = ParagraphAlignment.Left;

            //footer
            pageFooterText = string.Format(" report del {0} ", currentTime.ToShortDateString()) + "\n";
            Paragraph footer = page.Footers.Primary.AddParagraph();

            footer.AddText(pageFooterText);
            footer.Format.Alignment = ParagraphAlignment.Center;

            table.Style               = "tabella";
            table.Borders.Color       = Colors.Black;
            table.Borders.Width       = 0.25;
            table.Borders.Left.Width  = 0.5;
            table.Borders.Right.Width = 0.5;
            table.Rows.LeftIndent     = 0;

            colonna = table.AddColumn("6cm");
            colonna.Format.Alignment = ParagraphAlignment.Left;
            colonna = table.AddColumn("3.5cm");
            colonna.Format.Alignment = ParagraphAlignment.Left;
            colonna = table.AddColumn("3.5cm");
            colonna.Format.Alignment = ParagraphAlignment.Left;
            colonna = table.AddColumn("3.5cm");
            colonna.Format.Alignment = ParagraphAlignment.Left;

            infoPremilinari.AddText("\nPeriodo di riferimento: ");
            infoPremilinari.AddFormattedText(periodoRiferimento, TextFormat.Bold);
            infoPremilinari.AddText("\n\n");


            page.Add(infoPremilinari);
            Row riga = table.AddRow();

            riga.Style = "rigaBold";
            riga.Cells[0].AddParagraph("Locale");
            riga.Cells[1].AddParagraph("acconto");
            riga.Cells[2].AddParagraph("recupero \n da riportare");
            riga.Cells[3].AddParagraph("da Riportare");
            riga.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            riga.Cells[1].Format.Alignment = ParagraphAlignment.Right;
            riga.Cells[2].Format.Alignment = ParagraphAlignment.Right;
            riga.Cells[3].Format.Alignment = ParagraphAlignment.Right;

            foreach (var value in info)
            {
                riga = table.AddRow();
                int position = value.data.IndexOf(" ");

                if (value.acconto == 0 && value.recupero == 0 && value.daRiportare == 0)
                {
                    riga.Cells[0].AddParagraph(value.nomeLocale + "\n" + value.data.Substring(0, position));
                    riga.Cells[0].Style = "testoLightBlu";
                    riga.Cells[1].AddParagraph("*** OPERAZIONE GENERICA ***");
                    riga.Cells[1].Format.Alignment = ParagraphAlignment.Left;
                    riga.Cells[1].MergeRight       = 2;
                }
                else
                {
                    riga.Cells[0].AddParagraph(value.nomeLocale + "\n" + value.data.Substring(0, position));
                    if (value.acconto == 0)
                    {
                        riga.Cells[1].AddParagraph("");
                    }
                    else
                    {
                        riga.Cells[1].AddParagraph(String.Format("{0:0,0.00}", value.acconto));
                    }

                    if (value.recupero == 0)
                    {
                        riga.Cells[2].AddParagraph("");
                    }
                    else
                    {
                        riga.Cells[2].AddParagraph(String.Format("{0:0,0.00}", value.recupero));
                    }
                    if (value.daRiportare == 0)
                    {
                        riga.Cells[3].AddParagraph("");
                    }
                    else
                    {
                        riga.Cells[3].AddParagraph(String.Format("{0:0,0.00}", value.daRiportare));
                    }
                    riga.Cells[0].Format.Alignment = ParagraphAlignment.Left;
                    riga.Cells[1].Format.Alignment = ParagraphAlignment.Right;
                    riga.Cells[2].Format.Alignment = ParagraphAlignment.Right;
                    riga.Cells[3].Format.Alignment = ParagraphAlignment.Right;
                }
            }

            riga       = table.AddRow();
            riga.Style = "rigaBold";
            riga.Cells[0].AddParagraph("\nFlusso acconti\n\n");
            riga.Cells[1].AddParagraph("\n" + String.Format("{0:0,0.00}", acconto));
            riga.Cells[2].AddParagraph("");
            riga.Cells[2].MergeRight       = 1;
            riga.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            riga.Cells[1].Format.Alignment = ParagraphAlignment.Right;
            riga.Cells[2].Format.Alignment = ParagraphAlignment.Right;
            riga.Cells[0].Style            = "testoNero";
            riga.Cells[1].Style            = "testoBlu";

            riga       = table.AddRow();
            riga.Style = "rigaBold";
            riga.Cells[0].AddParagraph("Flusso di cassa");
            riga.Cells[0].MergeRight = 1;
            riga.Cells[2].AddParagraph(String.Format("{0:0,0.00}", recupero));
            riga.Cells[3].AddParagraph(String.Format("{0:0,0.00}", daRiportare));
            riga.Cells[0].Format.Alignment = ParagraphAlignment.Left;
            riga.Cells[2].Format.Alignment = ParagraphAlignment.Right;
            riga.Cells[3].Format.Alignment = ParagraphAlignment.Right;


            riga       = table.AddRow();
            riga.Style = "rigaBold";
            riga.Cells[0].AddParagraph("Monete");
            riga.Cells[0].MergeRight = 1;
            riga.Cells[2].AddParagraph(String.Format("{0:0,0.00}", monete));
            riga.Cells[0].Format.Alignment = ParagraphAlignment.Right;
            riga.Cells[2].Format.Alignment = ParagraphAlignment.Right;
            riga.Cells[3].MergeDown        = 3;

            riga       = table.AddRow();
            riga.Style = "rigaBold";
            riga.Cells[0].AddParagraph("Carta");
            riga.Cells[0].MergeRight = 1;
            riga.Cells[2].AddParagraph(String.Format("{0:0,0.00}", carta));
            riga.Cells[0].Format.Alignment = ParagraphAlignment.Right;
            riga.Cells[2].Format.Alignment = ParagraphAlignment.Right;

            riga       = table.AddRow();
            riga.Style = "rigaBold";
            riga.Cells[0].AddParagraph("Tot. cassa");
            riga.Cells[0].MergeRight = 1;
            riga.Cells[2].AddParagraph(String.Format("{0:0,0.00}", monete + carta + recupero));
            riga.Cells[0].Format.Alignment = ParagraphAlignment.Right;
            riga.Cells[2].Format.Alignment = ParagraphAlignment.Right;
            riga.Cells[0].Style            = "testoNero";
            riga.Cells[2].Style            = "testoNero";

            riga       = table.AddRow();
            riga.Style = "rigaBold";
            riga.Cells[0].AddParagraph("\nFlusso di cassa\n\n");
            riga.Cells[0].MergeRight = 1;
            riga.Cells[2].AddParagraph("\n" + String.Format("{0:0,0.00}", monete + carta + recupero - daRiportare));
            riga.Cells[3].AddParagraph("\n");
            riga.Cells[0].Format.Alignment = ParagraphAlignment.Right;
            riga.Cells[2].Format.Alignment = ParagraphAlignment.Right;
            riga.Cells[3].Format.Alignment = ParagraphAlignment.Right;
            riga.Cells[0].Style            = "testoNero";
            riga.Cells[2].Style            = "testoRosso";

            riga       = table.AddRow();
            riga.Style = "rigaBold";
            riga.Cells[0].AddParagraph("\nCassa Generale\n\n");
            riga.Cells[0].MergeRight = 1;
            riga.Cells[2].AddParagraph("\n" + String.Format("{0:0,0.00}", acconto + monete + carta + recupero - daRiportare));
            riga.Cells[3].AddParagraph("\n");
            riga.Cells[0].Format.Alignment = ParagraphAlignment.Right;
            riga.Cells[2].Format.Alignment = ParagraphAlignment.Right;
            riga.Cells[3].Format.Alignment = ParagraphAlignment.Right;
            riga.Cells[0].Style            = "testoNero";
            riga.Cells[2].Style            = "testoNero";

            page.Add(table);

            PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(true);

            pdfRenderer.Document = document;
            pdfRenderer.RenderDocument();
            pdfRenderer.PdfDocument.Save(pathFileName);

            //Process.Start(fileName);
            return(fileName);
        }
    // generate pdf file
    private string GeneratePDFFile(string customerID)
    {
        Document document = new Document();

        document.DefaultPageSetup.TopMargin    = "1cm";
        document.DefaultPageSetup.LeftMargin   = "1cm";
        document.DefaultPageSetup.RightMargin  = "1cm";
        document.DefaultPageSetup.BottomMargin = "1cm";
        Section section = document.AddSection();

        // insert logo
        MigraDoc.DocumentObjectModel.Shapes.Image logo = section.AddImage(@"C:\Sales Call Report\Exco_logo.png");
        //MigraDoc.DocumentObjectModel.Shapes.Image logo = section.AddImage(@"\\10.0.0.6\Shopdata\Development\tiger\Exco_logo.png");

        logo.LockAspectRatio = true;
        logo.ScaleHeight     = 0.5;
        section.AddParagraph().AddLineBreak();
        // add title
        Paragraph paragraph = section.AddParagraph("Sales Call Report");

        paragraph.Format.Font.Color = Colors.Black;
        paragraph.Format.Font.Bold  = true;
        paragraph.Format.Font.Size  = "30";
        paragraph.Format.Alignment  = ParagraphAlignment.Center;
        section.AddParagraph(DateTime.Now.ToString("MM-dd-yyyy HH:mm:ss")).Format.Alignment = ParagraphAlignment.Center;;
        // add customer information
        string   query           = "select bvadr1, bvadr2, bvadr3, bvadr4, bvtelp, bvfax, bvcont, bvemal from cmsdat.cust where bvcust like '" + customerID + "'";
        string   customerAdd1    = string.Empty;
        string   customerAdd2    = string.Empty;
        string   customerAdd3    = string.Empty;
        string   customerAdd4    = string.Empty;
        string   customerTel     = string.Empty;
        string   customerFax     = string.Empty;
        string   customerContact = string.Empty;
        string   customerEmail   = string.Empty;
        ExcoODBC database        = ExcoODBC.Instance;

        database.Open(Database.CMSDAT);
        OdbcDataReader reader = database.RunQuery(query);

        if (reader.Read())
        {
            customerAdd1    = reader["bvadr1"].ToString().Trim();
            customerAdd2    = reader["bvadr2"].ToString().Trim();
            customerAdd3    = reader["bvadr3"].ToString().Trim();
            customerAdd4    = reader["bvadr4"].ToString().Trim();
            customerTel     = reader["bvtelp"].ToString().Trim();
            customerFax     = reader["bvfax"].ToString().Trim();
            customerContact = reader["bvcont"].ToString().Trim();
            customerEmail   = reader["bvemal"].ToString().Trim().Replace("mailto:", "");
        }
        else
        {
            throw new Exception("Getting customer information failed!");
        }
        reader.Close();
        paragraph = section.AddParagraph();
        paragraph.AddText(CustomerList.Text);
        paragraph.AddLineBreak();
        if (customerContact.Length > 0)
        {
            paragraph.AddText("Contact Person: " + customerContact);
            paragraph.AddLineBreak();
        }
        if (customerAdd1.Length > 0)
        {
            paragraph.AddText(customerAdd1);
            paragraph.AddLineBreak();
        }
        if (customerAdd2.Length > 0)
        {
            paragraph.AddText(customerAdd2);
            paragraph.AddLineBreak();
        }
        if (customerAdd3.Length > 0)
        {
            paragraph.AddText(customerAdd3);
            paragraph.AddLineBreak();
        }
        if (customerAdd4.Length > 0)
        {
            paragraph.AddText(customerAdd4);
            paragraph.AddLineBreak();
        }
        if (customerTel.Length > 0)
        {
            paragraph.AddText("Tel: " + customerTel);
            paragraph.AddLineBreak();
        }
        if (customerFax.Length > 0)
        {
            paragraph.AddText("Fax: " + customerFax);
            paragraph.AddLineBreak();
        }
        if (customerEmail.Length > 0)
        {
            paragraph.AddText("Email: " + customerEmail);
            paragraph.AddLineBreak();
        }
        // add sales person information
        query = "select Email, FirstName, LastName from tiger.dbo.[user] where UserName like '" + User.Identity.Name + "'";
        string salesEmail = string.Empty;
        string salesName  = string.Empty;

        database.Open(Database.DECADE_MARKHAM);
        reader = database.RunQuery(query);
        if (reader.Read())
        {
            salesEmail = reader["Email"].ToString().Trim();
            salesName  = reader["FirstName"].ToString().Trim() + " " + reader["LastName"].ToString().Trim();
        }
        else
        {
            throw new Exception("Getting sales information failed!");
        }
        reader.Close();
        // add sales call report information
        section.AddParagraph().AddLineBreak();
        MigraDoc.DocumentObjectModel.Tables.Table table = section.AddTable();
        table.Format.Alignment    = ParagraphAlignment.Center;
        table.Style               = "Table";
        table.Borders.Width       = 1;
        table.Borders.Color       = Colors.Black;
        table.Borders.Width       = 0.25;
        table.Borders.Left.Width  = 0.5;
        table.Borders.Right.Width = 0.5;
        table.Rows.LeftIndent     = 0;
        MigraDoc.DocumentObjectModel.Tables.Column column = table.AddColumn("3.5cm");
        column.Format.Alignment = ParagraphAlignment.Center;
        column = table.AddColumn("3cm");
        column.Format.Alignment = ParagraphAlignment.Center;
        column = table.AddColumn("3cm");
        column.Format.Alignment = ParagraphAlignment.Center;
        column = table.AddColumn("3cm");
        column.Format.Alignment = ParagraphAlignment.Center;
        column = table.AddColumn("3cm");
        column.Format.Alignment = ParagraphAlignment.Center;
        column = table.AddColumn("3cm");
        column.Format.Alignment = ParagraphAlignment.Center;
        MigraDoc.DocumentObjectModel.Tables.Row row = table.AddRow();
        row.Cells[0].AddParagraph("Sales");
        row.Cells[0].Format.Font.Bold = true;
        row.Cells[1].MergeRight       = 1;
        row.Cells[1].AddParagraph(salesName);
        row.Cells[3].AddParagraph("Email");
        row.Cells[3].Format.Font.Bold = true;
        row.Cells[4].MergeRight       = 1;
        row.Cells[4].AddParagraph(salesEmail);
        row = table.AddRow();
        row.Cells[0].AddParagraph("Visit");
        row.Cells[0].Format.Font.Bold = true;
        row.Cells[1].MergeRight       = 1;
        row.Cells[1].AddParagraph(DateText.Text);
        row.Cells[3].AddParagraph("Follow Up");
        row.Cells[3].Format.Font.Bold = true;
        row.Cells[4].MergeRight       = 1;
        row.Cells[4].AddParagraph(FollowUpText.Text);
        row = table.AddRow();
        row.Cells[0].AddParagraph("Number of Presses");
        row.Cells[0].Format.Font.Bold = true;
        row.Cells[1].AddParagraph(PressText.Text);
        row.Cells[2].AddParagraph("Est. Die Exp./Mn");
        row.Cells[2].Format.Font.Bold = true;
        row.Cells[3].AddParagraph(ExpenseText.Text);
        row.Cells[4].AddParagraph("Other Suppliers");
        row.Cells[4].Format.Font.Bold = true;
        row.Cells[5].AddParagraph(SupplierText.Text);
        row = table.AddRow();
        row.Cells[0].AddParagraph("Attendee's");
        row.Cells[0].Format.Font.Bold = true;
        row.Cells[1].MergeRight       = 4;
        row.Cells[1].AddParagraph(AttendeeText.Text);
        row = table.AddRow();
        row.Cells[0].AddParagraph("Purpose of Visit");
        row.Cells[0].Format.Font.Bold = true;
        row.Cells[1].MergeRight       = 4;
        row.Cells[1].AddParagraph(AdjustWordWrap(PurposeText.Text));
        row.Cells[1].Format.Alignment = ParagraphAlignment.Left;
        row = table.AddRow();
        row.Cells[0].AddParagraph("Addtional Information");
        row.Cells[0].Format.Font.Bold = true;
        row.Cells[1].MergeRight       = 4;
        row.Cells[1].AddParagraph(AdjustWordWrap(InformationText.Text));
        row.Cells[1].Format.Alignment = ParagraphAlignment.Left;
        row = table.AddRow();
        row.Cells[0].AddParagraph("How can ETS Increase Business");
        row.Cells[0].Format.Font.Bold = true;
        row.Cells[1].MergeRight       = 4;
        row.Cells[1].AddParagraph(AdjustWordWrap(IncreaseText.Text));
        row.Cells[1].Format.Alignment = ParagraphAlignment.Left;
        // render pdf
        PdfDocumentRenderer pdfRenderer = new PdfDocumentRenderer(false, PdfFontEmbedding.Always);

        pdfRenderer.Document = document;
        pdfRenderer.RenderDocument();
        filesubPath = @"sales call report by " + User.Identity.Name + " at " + DateTime.Now.ToString("yyyy-MM-dd HH.mm.ss") + ".pdf";
        //string filePath = @"C:\Sales Call Report\" + filesubPath;
        //string filePath = @"\\10.0.0.6\Shopdata\Development\tiger\Sales Call Report\sales call report by " + User.Identity.Name + " at " + DateTime.Now.ToString("yyyy-MM-dd HH.mm.ss") + ".pdf";
        //string filePath = @"C:\Sales Call Report\" + filesubPath;
        string filePath = Server.MapPath("~/Sales Call Report PDF/" + filesubPath);

        if (Directory.Exists(Server.MapPath("~/Sales Call Report PDF/")))
        {
            if (File.Exists(filePath))
            {
                File.Delete(filePath);
            }
        }
        else
        {
            Directory.CreateDirectory(Server.MapPath("~/Sales Call Report PDF/"));
        }

        pdfRenderer.PdfDocument.Save(filePath);

        return(filePath);
    }