Friday, 6 February 2015

Templating in Rails by using .docx and unoconv

In practice we often use to convert docx files in several forms as like PDF and doc file by using unoconv utility in Ubuntu.

There is a general issue with  converting docx files having image in that file i.e image background will be change.while converting docx file to doc unoconv change image property. if you set image background to no fill in docx then it will be 'white background' in doc file.


To resolve this issue you can do the following steps:
1. Extract .docx file and go to 'test_docx_files/word/media' folder.
2. Put your image inside  'test_docx_files/word/media' folder.
3. Convert your image to '.emf' file and rename to to 'image1.emf'.
4. Come to  'test_docx_files' and run following command:

`zip -r ../hest1.docx .`

this will create a .docx file named 'test1.docx' outside of the 'test_docx_files' folder.
5. convert this .docx file to .doc file.

Now you can see your image is having same property as like in .docx file.

No comments:

Post a Comment