Comments (14)
ok. Please describe the way you use the library, so it's easier to create an appropriate api.
is it a web app?
from scriptlet4docx.
yes it is web app,
Example: templates are in db. i need to process one of them and put it in response.
way to do it now:
- create tmp file with template
- process template and save it another tmp file
- copy processed file in response outputstream
from scriptlet4docx.
I suppose easier way to get api somthing like:
DocxTemplater(InputStream is)
process(OutputStream os, ...)
from scriptlet4docx.
Yeah, it makes sense. It will be a utility wrapper around file API at first.
Thing I am aware of is output stream closing..
The other thing is caching input streams data (for example, you do not want to do a heavy preprocess every time the templater is invoked, it's better to have it caching some intermediate template results)
I will think it through.
from scriptlet4docx.
About cache, normal practice is to use cache key or id...
from scriptlet4docx.
Streaming and caching features are implemented in version 0.7. Please check it out.
Note that the new version will appear at maven central as soon as sonatype sync happens. This may require a week or so.
If you need the new features ultimately, simply install project to local maven repo using mvn install
.
from scriptlet4docx.
Why is not available outputstream api for processed template?
from scriptlet4docx.
Thanks for the note!
I completely lost that point, sorry.
Will add it ASAP.
from scriptlet4docx.
Now it's done: see processAndReturnInputStream
method.
from scriptlet4docx.
Why does method return InputStream? Why just not copy data to outstream like in example above? Because it is no deffirance copy data from file or from inputstream, if i need for example put data in response.
from scriptlet4docx.
Makes sence... Will add soon, in .0.7.2.
from scriptlet4docx.
P.S. It is very usefull library. Realy i didnt meet any another library, that works stable with docx templates. I hope you will impove this. Thank You!
from scriptlet4docx.
That's nice! If you see an option of library promotion I would be pleased to listen.
from scriptlet4docx.
OutputStream feature added
from scriptlet4docx.
Related Issues (20)
- Dynamic Images HOT 2
- Cannot use && in conditions HOT 1
- Need ability to render <w:br/> HOT 3
- Gracefully use null replacements in case of missing property in template params HOT 4
- No property in template. HOT 1
- Line Break Characters aren't working correctly HOT 7
- Empty lines in the final document instead of blocks <% %> HOT 3
- Problem with some formatting fields
- ๅพ็
- Method code too large HOT 2
- Tags which are not part of param should be set as empty after the generation
- TableScriptingRowProcessor to support unicode
- Null placeholder HOT 2
- Table scripting does not work when <w:tr> construction is used within docx source HOT 1
- Table scripting does not work when there is <w:tr* tags inside table cell HOT 1
- Scriptlets don't allow using '>', '<', '"' HOT 1
- Cache cleanup for specific template key. HOT 5
- Scriptlets donยดt work in header and Footer HOT 3
- Unable to use quotes in expressions HOT 7
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 scriptlet4docx.