如何从Flutter移动应用程序将Excel文件导出为PDF [英] How to export an Excel file as PDF from a Flutter mobile app

查看:172
本文介绍了如何从Flutter移动应用程序将Excel文件导出为PDF的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以使用电子表格解码包从我的移动Flutter应用生成Excel文件.我还可以将其另存为Excel文件.

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.

我现在需要的是:

  1. 将Excel工作簿导出为PDF.像Excel这样的应用程序可以做到这一点,但它具有特殊的导出形式,用户必须指定是否只导出当前显示的工作表或整个工作簿.如果要对溢出的列进行缩放以使其适合,或者对溢出的行进行缩放以使其适合,则也可以进行缩放.这使得将电子表格导出为PDF非常棘手.只有Excel,Google表格应用程序和专用小部件似乎可以做到这一点.我需要可以做到的第三方插件.Syncfusion似乎具有可用于.net和 xamarin应用的小部件,但是对于 Flutter ,在我撰写本文时,它仅允许生成电子表格.

  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.

理想情况下,我还希望用户能够从我的应用程序查看或预览电子表格.无需他现在就可以编辑电子表格,只需阅读即可.

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.

同样,当前可用于Xamarin等其他移动框架.

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

市场上是否有当前可用于Flutter的小部件或组件包?

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

推荐答案

我实际上并没有使用它,但是它可能有用:此程序包表示正在开发向PDF的转换.您也许可以使用主版本.

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.

否则,您可以尝试使用小部件网格和 pdf包自己绘制PDF>.如果您只需要显示数字,这应该很容易,并且也应该易于在您的应用程序中显示.如果您需要图形,图表等,我不知道该怎么做.您可能会以类似

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.

这篇关于如何从Flutter移动应用程序将Excel文件导出为PDF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆