Print Different Sheets

Posted by: luisribeiro on 6 August 2018, 1:15 am EST

    • Post Options:
    • Link

    Posted 6 August 2018, 1:15 am EST

    Hi

    I need to create a report solution that will have different pages with different tables and charts. This report my have 5 different pages (for example) with several tables that are independent and may grow vertically and other charts and data representation that will not grow in size.

    Once pages could be completely different from each others, I was wandering what could be the best solution:

    1. I could use a single sheet where my report will be build horizontally. In this situation to add a new page there will be more new columns. I believe this solution will be easier to manege when printing and exporting. However, if one of the tables grows too much vertically, it will need more than one page and in this situation printing may be a mass.

    2. The other solution that could be cleaner to build, it’s using a one sheet to each report page. In this way, if one table grows vertically, it will need several pages from this sheet. The big challenge to me is to print different sheets to the same document, or export them to the same pdf (I believe that exporting individual sheets to a single xls workbook should not be a problem).

    I would appreciate your opinion regarding these two options or any other that you may thing that could be a better solution.

    Regards

  • Posted 6 August 2018, 4:18 am EST - Updated 30 September 2022, 2:52 am EST

    Just to explain a little better with examples.



    Image “Report 2 pages” shows a report with 2 pages, where on page 1 table1 fits in the page.



    Image “Report 4 pages” shows the same report, but this time table1 on page 1 grows vertically and it needs 2 more pages, so at the end it will became a 4 pages report and the printing order is vertical like indicated by the blue numbers.

  • Posted 6 August 2018, 10:47 pm EST

    Hello,

    It seems our specialized reporting solution ActiveReports will fit in your requirements. Please download the trial version from here and check the demos:

    https://www.grapecity.com/en/activereports

    In case you have any questions regarding reporting, you can post here:

    https://www.grapecity.com/en/forums/ar-dev

    Thanks,

    Deepak Sharma

  • Posted 7 August 2018, 1:19 am EST

    Hello

    I’m an ActiveReports user already, it’s quiet powerful but I use it for applications where the report layout it’s well defined and will not be changed. For this application in particular a tool like excel seems to be more flexible allowing the final user to change the report content and format, that’s why I’m pointing to spread. My mainly issues are with printing and pdf exporting.

    Regards

  • Posted 7 August 2018, 8:24 pm EST

    Hello,

    To printing all the sheets to one PDF, you can use use the code as follows:

    System.IO.Stream s;

    s = System.IO.File.Open(“D:\testprint\test.pdf”, IO.FileMode.OpenOrCreate);

    FpSpread1.SavePdf(-1, s); // -1 for all sheets

    Thanks,

    Deepak Sharma

  • Posted 10 August 2018, 3:26 am EST

    Hello

    In did, it seems that it could work.

    Deal with page numbers when Printing or Exporting a single sheet it’s ok, but when exporting all the sheets to pdf how can I write page number and total pages on each footer page? I believe I can change the footer with printevent but only when printing and not when export to pdf. Don’t know also how can I get the total number of pages when printing all the sheets.

    Regards

  • Posted 12 August 2018, 8:01 pm EST

    Hello,

    You can insert the footer and set the text as per your choice. To insert the page number you can use the code as follows:

    
    FarPoint.Web.Spread.PrintInfo printset = new FarPoint.Web.Spread.PrintInfo();
    printset.Colors = new Drawing.Color[] {Drawing.Color.Green, Drawing.Color.Yellow, Drawing.Color.Gold, Drawing.Color.Indigo, Drawing.Color.Brown};
    printset.Images = new System.Drawing.Image[] {System.Drawing.Image.FromFile("C:\\images\\point.jpg"), System.Drawing.Image.FromFile("C:\\images\\logo.gif"), System.Drawing.Image.FromFile("C:\\images\\icon.jpg")};
    printset.Header = ""/fn\"Book Antiqua\" /fz\"14\" Print job for GrapeCity Inc./n ";
    printset.Footer = "/g\"1\"/r/cl\"4\"This is page /p of /pc";
    // Set the PrintInfo property for the first sheet.
    fpSpread1.Sheets[0].PrintInfo = printset;
    // Print the sheet.
    fpSpread1.SavePdf("c:\\test.pdf"); 
    
    
    

    Thanks,

    Deepak Sharma

  • Posted 13 August 2018, 9:54 pm EST

    Hello

    It seems that code “/pc” only gives the total number of pages inside each sheet. If I print a sheet with 4 pages and another one with 2 pages, when printing all the sheets together I would like to have the total number of pages, in this case, 6.

    Regards

  • Posted 16 August 2018, 12:52 am EST

    Hello,

    This is correct behavior, every Sheet has a PrintInfo property and a separate PrintInfo object is assigned to each sheet. The PrintInfo object can have different properties assigned to each sheet so I don’t think it can be overridden.

    Sorry for the inconvenience.

    Thanks,

    Deepak Sharma

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels