Comments (7)
I agree that getting used to MailMerge fields takes some time. When I started writing this library I didn't want to bet everything on them, so I tried to structure the code in a way, which should make it possible to add different kinds of fields.
Having simple text markers like {{expression}}
or <<expression>>
is a possibility but brings other inconveniences. Word mechanisms like spell-checking mess with the xml structure making it very hard to properly identify the markers. From my tests, it's hard to correctly parse out expressions in flowing text.
Also note that word provides a function to update all MailMerge field labels. This should make it less painful to spot bad edits like the ones you described above.
from sablon.
@TheBerg any thoughts?
from sablon.
@senny We decided to postpone this feature in our app because of some of the weirdness of how MailMerge labels work in MS Word. When we get back we plan on trying to add text markers to this project, we just didn't have the time to do that. In the meantime we are using liquid & wkhtmltopdf to get the same results, just makes it harder for our end users to be able to make changes.
from sablon.
Thank you for the heads up, I'm going to close this for now. Feel free to ping me again if you have questions.
from sablon.
I'm thinking of monkeypatching Sablon to specify my own text markers. My project is ok treating edge cases like spell-check as unspecified behavior.
Does that sound do-able? I'm guessing I'll need to change the KEY_PATTERN
in mail_merge.rb and edit the field handlers.
Let me know if you think this is crazy. Or if it sounds useful I can post a snippet if / when I get working code, in case more folks want to experiment with this.
from sablon.
Hi @7imon7ays I'm not sure I understand what you are trying to accomplish, changing the KEY_PATTERN
may be sufficient if you are still looking for mail merge fields. If you are looking for a different XML node then more logic will need changed.
from sablon.
Yes I was hoping to use something other than mail merge fields because Google Docs doesn't support those. But if it requires too much of a hack I'll try another solution first. Thank you.
from sablon.
Related Issues (20)
- Can i access a specific item in an array? HOT 2
- Dynamic Table Columns HOT 3
- Adding table to html creates corrupted file HOT 3
- template members get automatically stripped HOT 3
- image: "auto" property to keep aspect ratio HOT 2
- HTML Table got inserted without width HOT 1
- Conditionals: allow string comparism HOT 4
- Remove empty pages on the generated docx HOT 4
- Issue with inserting a Hyperlink via HTML content. HOT 2
- Table header: repeat on subsequent pages HOT 1
- Use mail merge fields in LibreOffice Writer HOT 1
- nested tables support? HOT 5
- Insert new mail merge fields using sablon HOT 2
- How to iterate over values of a hash? HOT 1
- Insert Templates into one another HOT 2
- Is it possible to specify the Word "Table Style" with an HTML <table>?
- Re-using content with images on multiple renders HOT 5
- p is not a valid child element of div HOT 4
- Injecting text-align: justify into docx file
- Unicode control characters in inputs may break generation of documents HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sablon.