Comments (1)
I think I've found something!
As it is explained in the README file, the code used to generate the report is this:
def print
.
.
.
send_data report.generate, type: 'application/vnd.oasis.opendocument.text',
disposition: 'attachment',
filename: 'report.odt'
end
In my case, I need to open the generated file as soon as it is generated (no need to save it). To do so, I used this:
def print
.
.
.
path = "#{Rails.root}/app/reports/generated/report.odt"
report.generate(path)
`libreoffice #{path}`
`rm -rf #{path}`
end
Explaining
First, I save the path to the file that will be generated (I've also created a folder in /app/reports
called generated
to organize the reports);
Then, I generate the report using report.generate(path)
;
To open this file on libreoffice, I'm calling `libreoffice #{path}`
. It opens LibreOffice with the generated file.
To wrap it up, I call `rm -rf #{path}`
to delete the report.
Notes
- Code on rb files inside `` is executed as command lines;
- This
print
action is inside my controller and there is aPUT
route to it.
from odf-report.
Related Issues (20)
- optional image HOT 3
- Combine documents HOT 1
- odf files that generated by odf-report v0.7.0 be recognized as "broken file" in Microsoft Word HOT 3
- Subtotals HOT 1
- Word found unreadable content in "report.odt" (and workaround) HOT 8
- Insert line break inside placeholder HOT 1
- How update table of contents index of a stored template? v0.7.2 HOT 1
- Nokogiri related memory not freed when `inner_html=` is called HOT 4
- Feature request: Delete table if it has no rows HOT 1
- Nokogiri::CSS::SyntaxError: unexpected '|' after '#<Nokogiri::CSS::Node:0x000000012ae10458>' HOT 8
- example of including conditional content in a document? HOT 2
- Example for some simple html-formatting HOT 5
- `add_image' for a section is not available
- Please upgrade rubyzip HOT 3
- All mock-images replaced by one (same) image? HOT 2
- Preserve html formatting HOT 1
- Error "no implicit conversion of nil into String (TypeError)" from report.generate HOT 1
- Placeholders inside table are not replaced HOT 3
- Rubyzip 1.3 or 2.0 HOT 1
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 odf-report.