Reputation: 7233
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:
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.
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?
Upvotes: 0
Views: 4782
Reputation: 1886
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.
Upvotes: 1