Git Product home page Git Product logo

Comments (14)

snowindy avatar snowindy commented on July 19, 2024

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.

RushPVA avatar RushPVA commented on July 19, 2024

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:

  1. create tmp file with template
  2. process template and save it another tmp file
  3. copy processed file in response outputstream

from scriptlet4docx.

RushPVA avatar RushPVA commented on July 19, 2024

I suppose easier way to get api somthing like:
DocxTemplater(InputStream is)
process(OutputStream os, ...)

from scriptlet4docx.

snowindy avatar snowindy commented on July 19, 2024

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.

RushPVA avatar RushPVA commented on July 19, 2024

About cache, normal practice is to use cache key or id...

from scriptlet4docx.

snowindy avatar snowindy commented on July 19, 2024

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.

RushPVA avatar RushPVA commented on July 19, 2024

Why is not available outputstream api for processed template?

from scriptlet4docx.

snowindy avatar snowindy commented on July 19, 2024

Thanks for the note!
I completely lost that point, sorry.

Will add it ASAP.

from scriptlet4docx.

snowindy avatar snowindy commented on July 19, 2024

Now it's done: see processAndReturnInputStream method.

from scriptlet4docx.

RushPVA avatar RushPVA commented on July 19, 2024

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.

snowindy avatar snowindy commented on July 19, 2024

Makes sence... Will add soon, in .0.7.2.

from scriptlet4docx.

RushPVA avatar RushPVA commented on July 19, 2024

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.

snowindy avatar snowindy commented on July 19, 2024

That's nice! If you see an option of library promotion I would be pleased to listen.

from scriptlet4docx.

snowindy avatar snowindy commented on July 19, 2024

OutputStream feature added

from scriptlet4docx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.