Comments (10)
@alepore Can you upload a ruby script and a sablon template that reproduces the error? This would go a long way to help me debug the issue.
from sablon.
@senny thanks, simple reproduction script: http://s000.tinyupload.com/index.php?file_id=38574526047958687033
from sablon.
@alepore thanks for the reproduction. There was an issue with your template and with some minor modifications I was able to get the desired output:
While you did see the style "ListBullet" when authoring the template.docx
it was not actually part of the template. Word has a root template called Normal.dot
. That's where common styles are saved. While visible in Word, the styles of Normal.dot
are not part of your template by default.
The following steps allow you to manage the styles that are part of your template:
Once you copied the styles over from Normal.dot
and save your template the example should work as expected. As Sablon matures I'll add more template validation and introspection. It's a common pitfall and I'd like to make it more explicit.
Thanks for reporting. I'm going to close the issue but please report back if you get it working or still have questions related to your example.
from sablon.
Thanks for reply!
The gem is really easy to use, the hard part is definitely the word template :)
Something is wrong here because i see ListBullet
on both template.docx, output.docx and Normal.dot
but i still don't see the style on the output (but i can manually apply it)
from sablon.
@alepore did you try copying over the ListBullet
style from Normal.dotm
and overwrite the one in template.docx
. It might very well be that one is only a reference to the other. Copying over the style did the trick for me...
from sablon.
mhh i think i tried any way to add/copy the style.
the problem is with the list itself, because if a create another formatting style (like red color) and name it ListBullet
it works.
Maybe it's something with my list style...
from sablon.
@alepore that sounds very much like the issue I described... You can't change the styles of Normal.dotm
so when you modify a given style it's saved in the template itself. To use the default "ListBullet" style you should:
- Open your template
- Go to the organizer as described above
- Copy over "ListBullet" from "Normal.dotm" into your template
- Save & run Sablon
Those were the exact steps I used with your example.
from sablon.
@senny if i start with a clean setup and i open my template i don't have ListBullet
on Normal.dotm
but only on the template.
i can recreate the style, there's a optional checkbox to add it to Normal.dotm
, then i can follow your steps but i still don't see the list ;(
from sablon.
@alepore that sure is strange. If I open a blank word document in my case, the Normal.dotm
has all the predefined styles. Maybe you somehow managed to change your Normal.dotm
... Anyway, if using the style in the template document works, it must be defined somewhere. It's basically a matter of copying the right definition into the template to get it working. Modifying the style slightly usually gets the job done.
from sablon.
Just FYI:
I used Office 2016 for mac and now it works.
There was definitely something wrong with Office 2011 for Mac.
Thanks again for support!
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.