扑来以生成单词(.docx),并插入表中的图像

发布于 2025-02-13 05:41:31 字数 173 浏览 2 评论 0原文

我正在制作flutter应用程序中,我们可以在其中选择图片,然后在表中插入选定的图像生成MS Word文件。最初,我将生成一个带有表的PDF并转换为Word,并在此上取得了进展。我生成了PDF,但是当我转换为单词时,我会看到它被转换为一个大图像,而不是带有图像的桌子,因为我有时会在单词中更改图像。现在,我被任何人都可以帮助您前进。

I am in process of making a Flutter App where we can select pictures and then generate a MS word file with selected images inserted in Table. Initially I though I will generate a pdf with table and convert to word and made progress on that. I generated pdf but when I convert to word I see its getting converted as one big image and not as Table with images as I need to alter images sometimes in word. Now I am struck can anyone help with some way forward.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

凤舞天涯 2025-02-20 05:41:32

尝试使用此软件包 docx_template

final f = File("template.docx");
  final docx = await DocxTemplate.fromBytes(await f.readAsBytes());


  // Load test image for inserting in docx
  final testFileContent = await File('test.jpg').readAsBytes();



  Content c = Content();
  c
    ..add(TextContent("docname", "Simple docname"))
    ..add(TableContent("table", [
      RowContent()
        ..add(TextContent("key1", "Paul"))
        ..add(ImageContent('img', testFileContent)),
    ]))

      

  final d = await docx.generate(c);
  final of = File('generated.docx');
  if (d != null) await of.writeAsBytes(d);

Try using this package docx_template

final f = File("template.docx");
  final docx = await DocxTemplate.fromBytes(await f.readAsBytes());


  // Load test image for inserting in docx
  final testFileContent = await File('test.jpg').readAsBytes();



  Content c = Content();
  c
    ..add(TextContent("docname", "Simple docname"))
    ..add(TableContent("table", [
      RowContent()
        ..add(TextContent("key1", "Paul"))
        ..add(ImageContent('img', testFileContent)),
    ]))

      

  final d = await docx.generate(c);
  final of = File('generated.docx');
  if (d != null) await of.writeAsBytes(d);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文