Comments (3)
Hi Angelo,
Thanks for your response. You're right is about a Velocity template comment => off topic, sorry.
I don't think is a bad idea to format date inside the Velocity template. In fact, this aspect concerns the UI layer and it's the purpose of a template, isn't it ?
Any way, for my problem, here is my solution
A declare a DateTool instance
context.put("date", new DateTool());
DateTool is a class from Velocity-tools-x.x.jar. You need to add this dependency into your pom.xml.
Into the Velocity template (in fact the docx template), i change for that
$date.format("dd-MM-yyyy", $incoming.birthday)
Mickael
from xdocreport.
@mickaelbaron your issue is about Velocity template engien uses. To be honnest with you I have never played with date & Velocity. You can find a sample at http://www.java2s.com/Code/Java/Velocity/HowtouseDateinVelocity.htm
IMHO I think it's a bad idea to format date inside docx template, because mergefield write is more complex.
from xdocreport.
I don't think is a bad idea to format date inside the Velocity template. In fact, this aspect concerns the UI layer and it's the purpose of a template, isn't it ?
I agree with you, docx template is the UI Layer. When you use Velocity to generate HTML, I agree with you, date must be formatted inside the template. In this case, the HTML template is written by a developer.
But in the case of docx template, I think formatting must be done not inside docx template because :
- template can be created by a non developer (like secratary), so field name must be simple.
- when mergefield is too long, MS Word doesnt displays the full name of the mergefield. So it's a little hard to read the field name.
- the XDocReport Macro https://code.google.com/p/xdocreport/wiki/DocxDesignReportMacro works with simple field name.
from xdocreport.
Related Issues (20)
- Possibility to upgrade odfdom-java lib to version 0.10.0
- PDF converter from docx : words are overriding (examples attached) HOT 2
- Image/x-emf image is lost when word is transferred to pdf! HOT 1
- xDocreport/ Freemarker cannot add html styling inside list
- @w:p not working within unordered list item [docx] [freemarker] HOT 4
- Error: Cannot find converters from=ODT HOT 1
- For each slide/page
- Parallel processing on UNIX based systems do not convert each image to PDF
- XSLX support HOT 2
- Calling another constructor
- When word converts pdf, it cannot convert lines.
- Code Style outdated
- Сan you add the functionality described below? Shortly: getPayloadContentFromFile()
- Problems with null values management HOT 1
- $velocityCount problem HOT 1
- Convert to PDF error with grid HOT 2
- NoSuchMethodError while trying to convert odt to pdf HOT 3
- Footer page numbers not appearing after using PdfConverter HOT 2
- When converting docx to html, charts and shapes are ignored. HOT 2
- How to get into mapper.useTotalPageField() with the word document? 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 xdocreport.