lukasjarosch / go-docx

Replace placeholders inside docx documents with speed and confidence.
MIT License
204 stars 47 forks source link

能否支持if 和表格循环? #6

Closed xwinie closed 2 years ago

xwinie commented 3 years ago

能否支持if 和表格循环?

lukasjarosch commented 3 years ago

Sorry, please write english

extbe commented 3 years ago

Hi. I guess this is a feature request to support iteration over arrays and conditional rendering (if statement). It would be nice to be able to generate table rows based on some array of structs :)

lukasjarosch commented 2 years ago

Hey, sorry for getting back so late. I'm not really monitoring this repo anymore.

I've experimented with conditional rendering as well as insertion of new data. But implementing this would be very complex since the project's aim is not to project the WordprocessingML spec into a Go-struct. It is meant to work on the raw bytes of the document.

Thus injecting new XML structs is somewhat out-of scope, sorry.

There is one project on github which is aimed at such use-cases: https://github.com/unidoc/unioffice Unfortunately that project is not free of charge, which is why I've developed this library for my specific use-case.

But if you want to introduce that feature into this lib, I'm happily accepting PRs :)