0

I am able to generate an Excel file from my mobile Flutter app, using the spreadsheet decode package. I am also able to save it, on the device as an Excel file.

What I need now is:

  1. Export the Excel workbook as a PDF. An app like Excel can do it, but it has a special exporting form where the user has to specify if he wants to export only the currently displayed sheet, or the whole workbook. And also scaling, if overflowing columns should be scaled to fit, or overflowing rows scaled to fit. Which makes exporting a spreadsheet to PDF quite tricky. Only Excel, Google Sheets app and specialized widgets seem able to do it. I need a third party plugin that could do it. Syncfusion seems to have a widget that can do it for .net and xamarin apps, but for Flutter, at the time I am writing this, it only allows generating the spreadsheet.

  2. Ideally I would also like my user to be able to view or preview the spreadsheet from my app. No need for him to be able to edit the spreadsheet at this time, just be able to read it.

Again this is currently available for other mobile frameworks like Xamarin.

Is there a widget or package of component currently available on the market that can do that for Flutter?

1 Answer 1

1

I haven't actually used this, but it might be useful: this package says that conversion to PDF is in development. You might be able to use the master version.

Otherwise, you could try drawing the PDF yourself using something like a grid of widgets and the pdf package. This should be quite easy if you just need to display numbers and should also be easy to display in your app. I don't know how you'd do it if you needed graphs, charts, etc. You might start with something like this tutorial.

Finally, you could try some sort of online service to do the actual conversion for you and just display it in your app using native_pdf_view, which works very well and is quite easy to use.

Sign up to request clarification or add additional context in comments.

2 Comments

thanks, yes, creating a table in PDF could work, I am considering it, using this package syncfusion.com/flutter-widgets/pdf-library or maybe one of the ones you suggested, but it would imply creating and maintaining two separate reports, one in excel, the other in pdf, which, compared to just exporting the excel as pdf, would be almost double the work
I really meant to create a "generic" converter from Excel to PDF, so you wouldn't be maintaining to separate reports: you would have one report in Excel and a separate converter, that would read the spreadsheet and generate a PDF. Don't know if that makes sense

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.