Represents a row of a table.
Inheritance: DocumentObject, IVisitable
コード例 #1
0
ファイル: Rows.cs プロジェクト: GorelH/PdfSharp
    /// <summary>
    /// Adds a new row to the rows collection. Allowed only if at least one column exists.
    /// </summary>
    public Row AddRow()
    {
      if (Table.Columns.Count == 0)
        throw new InvalidOperationException("Cannot add row, because no columns exists.");

      Row row = new Row();
      Add(row);
      return row;
    }
コード例 #2
0
 private static void CreateRow(PdfRowParameters rowParameters)
 {
     MigraDoc.DocumentObjectModel.Tables.Row row = rowParameters.Table.AddRow();
     for (int i = 0; i < rowParameters.Texts.Count; ++i)
     {
         FillCell(new PdfCellParameters
         {
             Cell               = row.Cells[i],
             Text               = rowParameters.Texts[i],
             Style              = rowParameters.Style,
             BorderWidth        = 0.5,
             ParagraphAlignment = rowParameters.ParagraphAlignment
         });
     }
 }
コード例 #3
0
        /// <summary>
        /// Render row into the table
        /// </summary>
        public void RenderInto(MigraDoc.DocumentObjectModel.Tables.Table table)
        {
            MigraDoc.DocumentObjectModel.Tables.Row row = table.AddRow();

            for (int i = 0; i < this.values.Length; i++)
            {
                Cell cell = row.Cells[i];
                cell.VerticalAlignment = VerticalAlignment.Center;

                this.values[i].RenderInto(cell);
            }

            if (this.color != null)
            {
                row.Shading.Color = this.color.GetColor();
            }
        }
コード例 #4
0
ファイル: Summary.cs プロジェクト: nastaranch/ApsimX
        /// <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);
            }
        }
コード例 #5
0
        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("МПК");
        }
コード例 #6
0
ファイル: DdlParser.cs プロジェクト: Sl0vi/MigraDoc
        /// <summary>
        /// Parses the keyword «\row».
        /// </summary>
        private void ParseRow(Row row)
        {
            Debug.Assert(row != null);
            Debug.Assert(Symbol == Symbol.Row);

            ReadCode();
            if (Symbol == Symbol.BracketLeft)
                ParseAttributes(row);

            if (Symbol == Symbol.BraceLeft)
            {
                ReadCode();

                bool loop = true;
                int idx = 0;
                //int cells = row.Cells.Count;
                while (loop)
                {
                    switch (Symbol)
                    {
                        case Symbol.Eof:
                            ThrowParserException(DomMsgID.UnexpectedEndOfFile);
                            break;

                        case Symbol.BraceRight:
                            loop = false;
                            ReadCode();
                            break;

                        case Symbol.Cell:
                            ParseCell(row[idx]);
                            idx++;
                            break;

                        default:
                            ThrowParserException(DomMsgID.UnexpectedSymbol, Token);
                            break;
                    }
                }
            }
        }
コード例 #7
0
ファイル: VisitorBase.cs プロジェクト: Sl0vi/MigraDoc
 internal override void VisitRow(Row row)
 {
     foreach (Cell cell in row.Cells)
     {
         if (cell._verticalAlignment.IsNull)
             cell._verticalAlignment = row._verticalAlignment;
     }
 }
コード例 #8
0
 internal virtual void VisitRow(Row row) { }
コード例 #9
0
ファイル: PdfMaker.cs プロジェクト: seba992/HMApp
        public void createRowForLunch(Document document, Table table, Column column, int propId, Row row2)
        {
            float nettoSum = 0;
            float bruttoSum = 0;
            var extra = (from r in _ctx.PropMenuPosition
                         where r.Id_proposition == propId
                         select r).ToList();

            for (int i = 0; i < extra.Count; i++)
            {
                //Create table columns
                table.Rows.Height = 3;
                Row row = table.AddRow();

                string netto = ComputeNettoPrice((float)extra[i].BruttoPrice, (float)(extra[i].Vat)).ToString();

                row.Borders.Top.Visible = false;
                row.Cells[0].Shading.Color = Colors.LightGray;
                row.Cells[2].Shading.Color = Colors.LightGray;
                row.Cells[3].Shading.Color = Colors.LightGray;
                row.Cells[6].Shading.Color = Colors.LightGray;
                row.Cells[7].Shading.Color = Colors.LightGray;
                row.Cells[1].Format.Alignment = ParagraphAlignment.Center;
                row.Cells[2].Format.Alignment = ParagraphAlignment.Center;
                row.Cells[3].Format.Alignment = ParagraphAlignment.Center;
                row.Cells[4].Format.Alignment = ParagraphAlignment.Center;
                row.Cells[5].Format.Alignment = ParagraphAlignment.Center;
                row.Cells[6].Format.Alignment = ParagraphAlignment.Center;
                row.Cells[7].Format.Alignment = ParagraphAlignment.Center;

                row.Cells[1].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Center;
                row.Cells[2].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Center;
                row.Cells[3].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Center;
                row.Cells[4].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Center;
                row.Cells[5].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Center;
                row.Cells[6].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Center;
                row.Cells[7].VerticalAlignment = MigraDoc.DocumentObjectModel.Tables.VerticalAlignment.Center;

                row.Cells[0].AddParagraph(extra[i].TypeOfService);
                row.Cells[1].AddParagraph(Convert.ToDecimal(extra[i].BruttoPrice.ToString()).ToString("#,##0.00") + " zł");
                row.Cells[2].AddParagraph(Convert.ToDecimal(netto.ToString()).ToString("#,##0.00") + " zł");
                row.Cells[3].AddParagraph(extra[i].Vat.ToString() + "%");
                row.Cells[4].AddParagraph(extra[i].Amount.ToString());
                row.Cells[5].AddParagraph(extra[i].Days.ToString());
                row.Cells[6].AddParagraph(Convert.ToDecimal(((float)extra[i].Days * (float)extra[i].Amount * float.Parse(netto)).ToString()).ToString("#,##0.00") + " zł");
                row.Cells[7].AddParagraph(Convert.ToDecimal(((float)extra[i].Days * (float)extra[i].Amount * (float)extra[i].BruttoPrice).ToString()).ToString("#,##0.00") + " zł");
                nettoSum += (float)extra[i].Days * (float)extra[i].Amount * float.Parse(netto);
                bruttoSum += (float)extra[i].Days * (float)extra[i].Amount * (float)extra[i].BruttoPrice;

            }

            orderBruttoSum += bruttoSum;
            orderNettoSum += nettoSum;

            row2 = table.AddRow();
            row2.Cells[6].Format.Alignment = ParagraphAlignment.Center;
            row2.Cells[7].Format.Alignment = ParagraphAlignment.Center;
            row2.Cells[0].Shading.Color = Colors.LightGray;
            row2.Cells[0].Format.Font.Bold = true;
            row2.Cells[0].AddParagraph("PODSUMOWANIE");
            row2.Cells[1].MergeRight = 4;
            row2.Cells[6].AddParagraph(Convert.ToDecimal(nettoSum.ToString()).ToString("#,##0.00") + " zł");
            row2.Cells[7].AddParagraph(Convert.ToDecimal(bruttoSum.ToString()).ToString("#,##0.00") + " zł");
        }
コード例 #10
0
ファイル: Cell.cs プロジェクト: dankennedy/MigraDoc
 /// <summary>
 /// Resets the cached values.
 /// </summary>
 internal override void ResetCachedValues()
 {
     this.row = null;
       this.clm = null;
 }
コード例 #11
0
ファイル: PdfMaker.cs プロジェクト: ChristophWurst/UFO
 private void InsertArtistsIntoCells(Venue venue, Row row)
 {
     try {
         int i = 0;
         foreach (var timeSlot in timeSlots) {
             i++;
             SpectacledayTimeSlot daySlot = spectacleDayTimeSlots.Where(s => s.TimeSlotId == timeSlot.Id).FirstOrDefault();
             Performance performance = performances.Where(p => p.SpectacledayTimeSlot == daySlot.Id &&
                                                               p.VenueId == venue.Id).FirstOrDefault();
             Artist currArtist = null;
             if (performance != null) {
                 currArtist = artists.Where(a => a.Id == performance.ArtistId).FirstOrDefault();
             }
             if (currArtist == null) {
                 currArtist = new Artist() { Name = "" };
             }
             row.Cells[i].AddParagraph(currArtist.Name);
         }
     } catch (Exception e) {
         throw new BusinessLogicException($"Could not create PDF-File table cell value for artist." + e.Message);
     }
 }
コード例 #12
0
ファイル: RowRenderer.cs プロジェクト: dankennedy/MigraDoc
 internal RowRenderer(DocumentObject domObj, RtfDocumentRenderer docRenderer)
     : base(domObj, docRenderer)
 {
     this.row = domObj as Row;
 }
コード例 #13
0
    // 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);
    }