How to Create and Print PDF with Flexsheet

Posted by: curiosichi on 15 May 2019, 10:02 am EST

  • Posted 15 May 2019, 10:02 am EST

    I am looking for information on printing a PDF of a Flexsheet grid.

    My use case is: Angular 7, multi sheet Flexsheet, and desire to include a summary page and include a header/footer on every sheet with a grid sandwiched between. My flexsheet grids may stretch wider that a single sheet of paper on some sheets, and extend down several sheets. For these I would want it cut into multiple sheets between the header and footer described above.

    wjcGrid.pdf.FlexGridPdfConverter.draw(flexGrid, doc);
    

    I did find the above snippet, but I receive an error of "pdf does not exist on type ‘typeof import(“C:/Project/node_modules/wijmo/wijmo.grid”)’. Even with that problem solved though, I’d like some guidance on the other features.

    Thanks!

  • Posted 17 May 2019, 12:07 am EST

    Hi,

    We are currently working on this and will give you an update soon.

    Regards

    Sharad

  • Posted 19 May 2019, 10:41 pm EST

    Hi,

    Please refer to the following sample which demonstrates how we could use FlexGridPdfConverter class to draw flexsheet on PdfDocument:

    https://stackblitz.com/edit/js-txtwx7?file=index.js

  • Posted 23 May 2019, 10:12 am EST - Updated 3 October 2022, 4:39 am EST

    This is a great start and looks like we are on the right path!

    Here is a random page from the generated report (which btw is 350 pages long using the code provided):

    • This (and many other) page doesn’t included the header and footer I need present on every page (footer in my case is showing page number, header being report type and other user information). I believe this occurs when the grid is broken up into several different pages, but I need the header/footer info regardless on every page.

    • The calculations didn’t come across calculated

    • I need the ability to retain some formatting. I don’t need all of it from the grid visible on flexsheet in the web app, but I need the ability to select certain styles maybe (using applyCellsStyle maybe a second time to format the sheet just for printing). I can remain black and white for a document this size, but I need to be able to to shade headers or blank cells for example.

    • Lastly, the font is large. I need to be able to set a new smaller default font size when printing. 4-5 columns per sheet is not enough.

    I really appreciate the help with this. This is one of the last steps I need working to complete my project!

  • Posted 23 May 2019, 11:42 pm EST

    Please refer to the following responses:

    >> Headers and Footers

    You could use the header and footer properties of PdfDocument class to add header and footers.

    >> Calculations were not evaluated

    To evaluate the calculations while exporting, you may handle the formatItem property of IFlexGridDrawSettings and evaluate the calculations manually.

    >> Shade headers and blank cells

    For shading the headers, you may use the headerCellStyle property and set its backgroundColor property.

    For shading blank cells, you will need to use the formatItem property again and shade those cells which are empty.

    >> More columns on a single page

    There are various alternatives avalilable:

    • You may adjust the left-right margins to increase available drawing space

    • You may also change page orientation to landscape.

    • When using FlexGridPdfConverter.draw() method, you may pass optional height/width parameters to fit the grid in the specified width/height.

    API ref: https://www.grapecity.com/wijmo/api/classes/wijmo_grid_pdf.flexgridpdfconverter.html#draw

    • Further if you need to adjust width of only some columns, then what you could do is save the current width of the column locally, then update the width of the column as would like them to export and export the grid, and finally restore the width to its original value.

    Please refer to the following sample demosntrating the same:

    •Modifying col width during export: https://stackblitz.com/edit/js-dxzutx

    •Restricting grid width by passing width parameter to draw() method: https://stackblitz.com/edit/js-ex5at1

  • Posted 5 June 2019, 10:32 am EST - Updated 3 October 2022, 4:39 am EST

    I have gotten much further with my pdf project needs. The header I have created (as seen in the image) is more than just the single line. I am able to use the single line header you suggested, but I need the full header (boxed area) included on every page header with the ability to update the “Tab #” with the sheet number of the grid it is displaying. So if the table I have displayed covered 3 pages, I would want each of those three pages to show the full header, updating the right of the header with “Tab 1”

    Then when flexsheet 2 starts to get added to the output, the header would update to show “Tab 2” for all the sheets it displays on.

    I am following your code examples pretty closely and loop over each sheet in the flexsheet object, and while I created a function that generates the header as seen in my attached image, it only attaches to the top page for the grid; not the additional pages the grid may extend to on multi paged grids.

    My only guess is: is there a way to pass my desired header as an option of some sort to the wijmoGridPDF.FlexGridPdfConverter.draw?

    ==================================================

    My next question is my reports need to be ADA compliant. Using Adobe Pro, it has alerted me to issues with the PDF result of wijmo’s PdfDocument.

    ADA_report.zip

    Are you able to provide any additional support for ADA compliance, or do you have suggestions on how I could update the table so I can write my own custom PDF generator.

    Thanks!

  • Posted 5 June 2019, 10:02 pm EST

    Hi,

    Hello,

    Regarding Header text, you may handle the pageAdded event of PDFDocument class and change the header according to the current page. Please refer to the sample below:

    https://stackblitz.com/edit/js-m6zxyz

    I have asked the Dev Team about the ADA Compliance… Will update you on this soon.

  • Posted 24 June 2019, 7:21 am EST

    I wanted to check in and say your help has been greatly useful and appreciated. I am nearing completion of my report.

    The ADA Compliance is a major component that needs to be addressed though. Has the dev team responded?

    Our product cannot go live without a solution to this.

  • Posted 24 June 2019, 8:34 pm EST

    Hi,

    I have requested the concerned team for an update, Will get back to you on this tomorrow.

  • Posted 25 June 2019, 2:20 pm EST

    Hi,

    This feature is currently being researched by our Dev and they are unable to provide an ETA on the time that will take to Research and implement in future releases.

    Since you are added as a correspondent to this case you will be notified once this case get implemented.

  • Posted 17 October 2019, 7:13 am EST

    Is there any update on ADA compliance?

  • Posted 17 October 2019, 10:29 pm EST

    Hi,

    This feature is still in active development and is on the top of the ToDo list for Wijmo. Dev Team will actively work on feature this feature after November, hopefully we should have some updates thereafter

  • Posted 22 January 2020, 10:36 am EST

    any update?

  • Posted 22 January 2020, 8:59 pm EST

    Hi,

    The issue is still with the dev team. We are really sorry for the inconvenience caused.

  • Posted 23 June 2020, 9:10 am EST

    any update?

  • Posted 24 June 2020, 12:30 am EST

    Hi,

    The issue is still with the developers. I have asked them to provide an ETA on this.

    ~regards

  • Posted 8 June 2021, 2:21 am EST

    any update on this?

  • Posted 9 June 2021, 5:53 pm EST

    Hi curiosichi,

    The dev team is investigating the effort it will take to add this feature. So this feature is still in development.

    ~regards

Need extra support?

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

Learn More

Forum Channels