Discussions
Categories
Groups
Community Home
Categories
INTERNAL ENABLEMENT
POPULAR
PUBLIC CLOUD
PRIVATE CLOUD
Quick Links
MY LINKS
HELPFUL TIPS
Back to website
Home
Intelligence (Analytics)
how to call BIRT xlsx emitter from a servlet
krusifier
till now i was calling the by default file from a servlet to make xls by using
method.setPath("/birt/run?__report=abc.rptdesign&__format=xls");
response.setContentType("application/xls");
response.setHeader("Content-Disposition", "attachment; filename=abc Report.xls");
now i incorporated BIRT xlsx emitter and i've changed the path to
method.setPath("/birt/run?__report=abc.rptdesign&__emitterid=uk.co.spudsoft.birt.emitters.excel.XlsxEmitter&__format=xlsx");
response.setContentType("application/xlsx");
response.setHeader("Content-Disposition", "attachment; filename=abc Report.xlsx");
i am getting an error which i am attaching.
Find more posts tagged with
Comments
Yaytay
<blockquote class='ipsBlockquote' data-author="'krusifier'" data-cid="115219" data-time="1363760366" data-date="19 March 2013 - 11:19 PM"><p>
till now i was calling the by default file from a servlet to make xls by using<br />
<br />
method.setPath("/birt/run?__report=abc.rptdesign&__format=xls");<br />
response.setContentType("application/xls"); <br />
response.setHeader("Content-Disposition", "attachment; filename=abc Report.xls"); <br />
<br />
<br />
now i incorporated BIRT xlsx emitter and i've changed the path to<br />
<br />
method.setPath("/birt/run?__report=abc.rptdesign&__emitterid=uk.co.spudsoft.birt.emitters.excel.XlsxEmitter&__format=xlsx");<br />
response.setContentType("application/xlsx"); <br />
response.setHeader("Content-Disposition", "attachment; filename=abc Report.xlsx");<br />
<br />
i am getting an error which i am attaching.<br /></p></blockquote>
That looks like you don't have the SpudSoft emitter installed correctly.<br />
Is the seatbelt using he POJO report engine or the OSGi one?<br />
<br />
Jim
krusifier
<blockquote class='ipsBlockquote' data-author="'Yaytay'" data-cid="115243" data-time="1363806509" data-date="20 March 2013 - 12:08 PM"><p>
That looks like you don't have the SpudSoft emitter installed correctly.<br />
Is the seatbelt using he POJO report engine or the OSGi one?<br />
<br />
Jim<br /></p></blockquote>
<br />
<br />
HI Yaytay,<br />
i am using OSGi runtime sdk 3.7.2 and i've integrated BIRT runtime by deploying war in rational application developer(IBM RAD).<br />
<br />
I've read this article of yours
> <a class='bbc_url' href='
https://bitbucket.org/yaytay/spudsoft-birt-excel-emitters/wiki/Home'>https://bitbucket.org/yaytay/spudsoft-birt-excel-emitters/wiki/Home</a>
; and implemented all steps except the last one i.e. <br />
<br />
Modify your code to ensure that the correct emitter is used.<br />
if( "XLS".equalsIgnoreCase( outputFileFormat ) ) {<br />
renderOption.setEmitterID( "uk.co.spudsoft.birt.emitters.excel.XlsEmitter" );<br />
} else if( "XLSX".equalsIgnoreCase( outputFileFormat ) ) {<br />
renderOption.setEmitterID( "uk.co.spudsoft.birt.emitters.excel.XlsxEmitter" );<br />
}<br />
<br />
i don't know where to add/modify this piece of code or how to tell birt to use spudsoft emittter. I've read this blog too which was not of a great help
><a class='bbc_url' href='
http://birtworld.blogspot.in/2011/07/replacing-default-birt-xls-emitter.html'>http://birtworld.blogspot.in/2011/07/replacing-default-birt-xls-emitter.html</a>
;
Yaytay
You don't need that bit of code because the servlet interface lets you specify the emitter ID in the URL.
Can you get a complete directory tree listing of the exploded war as it is on your server and attach it here?
Feel free to redact any report information there.
Jim
krusifier
<blockquote class='ipsBlockquote' data-author="'Yaytay'" data-cid="115248" data-time="1363845535" data-date="20 March 2013 - 10:58 PM"><p>
You don't need that bit of code because the servlet interface lets you specify the emitter ID in the URL.<br />
<br />
Can you get a complete directory tree listing of the exploded war as it is on your server and attach it here?<br />
Feel free to redact any report information there.<br />
<br />
Jim<br /></p></blockquote>
<br />
Hey JIM,<br />
First of all thanks for your quick reply!<br />
I've tried that option of specifying the emitter id in the url in my servlet but still no luck!<br />
<br />
method.setPath("/birt/run?__report=abc.rptdesign&__emitterid=uk.co.spudsoft.birt.emitters.excel.XlsxEmitter&__format=xlsx");<br />
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"); <br />
response.setHeader("Content-Disposition", "attachment; filename=abc Report.xlsx");<br />
<br />
after this, ms office(excel) opens up with nothing to display not even empty spreadsheet.<br />
<br />
Don't have any idea of the exploded WAR that u were asking, please explain what do i need to give you and where will i get it in my code/application?
Yaytay
<blockquote class='ipsBlockquote' data-author="'krusifier'" data-cid="115252" data-time="1363850756" data-date="21 March 2013 - 12:25 AM"><p>
Don't have any idea of the exploded WAR that u were asking, please explain what do i need to give you and where will i get it in my code/application?<br /></p></blockquote>
<br />
I'm afraid this is going to be a bit vague because I don't know IBM RAD (I use Tomcat).<br />
Somewhere on your server you should find the war file and, at least in Tomcat, there should be the unzipped contents of the war - I'm after that directory listing (with all the subdirectories).<br />
It would be best if you could get it from the running server, but if that's not easy (or IBM RAD doesn't unzip the war) a straightforward listing of all the files (with their paths) inside the war file would be better than nothing.<br />
<br />
Jim
krusifier
<blockquote class='ipsBlockquote' data-author="'Yaytay'" data-cid="115253" data-time="1363851103" data-date="21 March 2013 - 12:31 AM"><p>
I'm afraid this is going to be a bit vague because I don't know IBM RAD (I use Tomcat).<br />
Somewhere on your server you should find the war file and, at least in Tomcat, there should be the unzipped contents of the war - I'm after that directory listing (with all the subdirectories).<br />
It would be best if you could get it from the running server, but if that's not easy (or IBM RAD doesn't unzip the war) a straightforward listing of all the files (with their paths) inside the war file would be better than nothing.<br />
<br />
Jim<br /></p></blockquote>
<br />
Hi JIM,<br />
I am attaching the screen shots of expanded BIRT.war ,see if that solves the purpose.
Yaytay
<blockquote class='ipsBlockquote' data-author="'krusifier'" data-cid="115255" data-time="1363856686" data-date="21 March 2013 - 02:04 AM"><p>
I am attaching the screen shots of expanded BIRT.war ,see if that solves the purpose.<br /></p></blockquote>
Hi,<br />
No, I'm afraid that's not what I mean.<br />
I need to see the contents of the finished war file - the screenshots there show what eclipse thinks it's going to put in the war file.<br />
<br />
If your server is running on Windows you can use a command like this to get what I want:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
C:\Program Files\eclipse-4.2.2>dir /S > C:\Temp\Files.txt
</pre>
And if you are running on linux something like this will do the job:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
[root@srv-lon-reports1 report-services##2.0-SNAPSHOT]# ls -lR >/tmp/Files.txt
</pre>
<br />
In both cases the command should be run from inside the directory that contains your war file.<br />
i.e., on tomcat, something like: /usr/share/apache-tomcat-reports/webapps/report-services##2.0-SNAPSHOT<br />
<br />
Alternatively, if it's not too big (which it probably is) and it doesn't contain proprietary code (which it probably does) you could just make your war file available for me to look at.<br />
<br />
Jim
krusifier
<blockquote class='ipsBlockquote' data-author="'Yaytay'" data-cid="115314" data-time="1363941970" data-date="22 March 2013 - 01:46 AM"><p>
Hi,<br />
No, I'm afraid that's not what I mean.<br />
I need to see the contents of the finished war file - the screenshots there show what eclipse thinks it's going to put in the war file.<br />
<br />
If your server is running on Windows you can use a command like this to get what I want:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
C:\Program Files\eclipse-4.2.2>dir /S > C:\Temp\Files.txt
</pre>
And if you are running on linux something like this will do the job:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
[root@srv-lon-reports1 report-services##2.0-SNAPSHOT]# ls -lR >/tmp/Files.txt
</pre>
<br />
In both cases the command should be run from inside the directory that contains your war file.<br />
i.e., on tomcat, something like: /usr/share/apache-tomcat-reports/webapps/report-services##2.0-SNAPSHOT<br />
<br />
Alternatively, if it's not too big (which it probably is) and it doesn't contain proprietary code (which it probably does) you could just make your war file available for me to look at.<br />
<br />
Jim<br /></p></blockquote>
<br />
<br />
Here is my file according to your instructions.<br />
<br />
Karan
Yaytay
<blockquote class='ipsBlockquote' data-author="'krusifier'" data-cid="115318" data-time="1363946232" data-date="22 March 2013 - 02:57 AM"><p>
Here is my file according to your instructions.<br />
<br />
Karan<br /></p></blockquote>
Darn, that's still not giving me what I want to see.<br />
Either that or you need an expert on WebSphere to help out.<br />
<br />
Are you building BIRT as a WAR or an EAR?<br />
I was hoping to get an understanding of how your app server sees the file, but I don't think I'm going to get that for WebSphere.<br />
Can you post a listing of the contents of the WAR file itself?<br />
On linux this can be done with: <br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
unzip -l report-services##2.0-SNAPSHOT.war
</pre>
<br />
There isn't a built-in way to do it on Windows, so it will depend on which zip tool you use.<br />
<br />
On either platform you can do:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
jar -tf report-services##2.0-SNAPSHOT.war
</pre>
But that doesn't list the file sizes, so I'd rather see the output from a zip tool.<br />
<br />
Jim
krusifier
<blockquote class='ipsBlockquote' data-author="'Yaytay'" data-cid="115341" data-time="1364019134" data-date="22 March 2013 - 11:12 PM"><p>
Darn, that's still not giving me what I want to see.<br />
Either that or you need an expert on WebSphere to help out.<br />
<br />
Are you building BIRT as a WAR or an EAR?<br />
I was hoping to get an understanding of how your app server sees the file, but I don't think I'm going to get that for WebSphere.<br />
Can you post a listing of the contents of the WAR file itself?<br />
On linux this can be done with: <br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
unzip -l report-services##2.0-SNAPSHOT.war
</pre>
<br />
There isn't a built-in way to do it on Windows, so it will depend on which zip tool you use.<br />
<br />
On either platform you can do:<br />
<pre class='_prettyXprint _lang-auto _linenums:0'>
jar -tf report-services##2.0-SNAPSHOT.war
</pre>
But that doesn't list the file sizes, so I'd rather see the output from a zip tool.<br />
<br />
Jim<br /></p></blockquote>
<br />
Hi Jim,<br />
<br />
I don't think i am going to figure out where websphere keeps the file or keep it at all.<br />
I am deploying BIRT as a WAR.<br />
<br />
i have a tree view of my birt.war if it would be useful.
krusifier
If its out of bounds, can we use page breaks? Please put some light on using explicit page breaks to eliminate this problem in cross tab reports.
Yaytay
<blockquote class='ipsBlockquote' data-author="'krusifier'" data-cid="115352" data-time="1364191973" data-date="24 March 2013 - 11:12 PM"><p>
Hi Jim,<br />
<br />
I don't think i am going to figure out where websphere keeps the file or keep it at all.<br />
I am deploying BIRT as a WAR.<br />
<br />
i have a tree view of my birt.war if it would be useful.<br /></p></blockquote>
Can you get the same but with the files listed as well as the directories?<br />
<br />
Jim
Yaytay
<blockquote class='ipsBlockquote' data-author="'krusifier'" data-cid="115355" data-time="1364203343" data-date="25 March 2013 - 02:22 AM"><p>
If its out of bounds, can we use page breaks? Please put some light on using explicit page breaks to eliminate this problem in cross tab reports.<br /></p></blockquote>
Is that meant to be on a different thread?<br />
<br />
Jim
krusifier
<blockquote class='ipsBlockquote' data-author="'Yaytay'" data-cid="115375" data-time="1364223670" data-date="25 March 2013 - 08:01 AM"><p>
Is that meant to be on a different thread?<br />
<br />
Jim<br /></p></blockquote>
<br />
No it isn't meant to be on a different thread, the problem was xls was not supporting because my report was extra wide(more than 300 columns) so i thought excel emitter was the only way to figure out a solution to this problem,but since its taking time i thought page break would be an option after 256 columns,but when i am doing a page break, it is not working in excel but it is working in webviewer. **** save me from Excel!!(on a lighter note)
krusifier
<blockquote class='ipsBlockquote' data-author="'Yaytay'" data-cid="115374" data-time="1364223648" data-date="25 March 2013 - 08:00 AM"><p>
Can you get the same but with the files listed as well as the directories?<br />
<br />
Jim<br /></p></blockquote>
<br />
I've attached a notepad file, this is what i can do with the command prompt max.<br />
<br />
I have previously attached an MS WORD file(in this thread only) which contains screenshots of my birt folder fully expanded.C if that helps a bit!
Yaytay
<blockquote class='ipsBlockquote' data-author="'krusifier'" data-cid="115396" data-time="1364273321" data-date="25 March 2013 - 09:48 PM"><p>
No it isn't meant to be on a different thread, the problem was xls was not supporting because my report was extra wide(more than 300 columns) so i thought excel emitter was the only way to figure out a solution to this problem,but since its taking time i thought page break would be an option after 256 columns,but when i am doing a page break, it is not working in excel but it is working in webviewer. **** save me from Excel!!(on a lighter note)
<br /></p></blockquote>
Well, you could try a completely different format.<br />
BIRT 4 includes emitters for OpenOffice, that I think Excel should be able to open - I don't know much more about them than that though.<br />
<br />
The built-in text emitters won't work very well with crosstabs (because they are data extraction processes, not really emitters).<br />
I think there are plugin emitters for CSV output, and for XML output, either of which should get the crosstabs data out, minus any formatting - but you are still left needing to get custom emitters working.<br />
<br />
The XLS format is inherently limited to about 250 columns. XLSX breaks that limit, but you'll need a custom emitter to get that.<br />
<br />
Jim
Yaytay
<blockquote class='ipsBlockquote' data-author="'krusifier'" data-cid="115397" data-time="1364274861" data-date="25 March 2013 - 10:14 PM"><p>
I've attached a notepad file, this is what i can do with the command prompt max.<br />
<br />
I have previously attached an MS WORD file(in this thread only) which contains screenshots of my birt folder fully expanded.C if that helps a bit!<br /></p></blockquote>
What I'm trying to see if the files, not the folders. <br />
I need to know that you've got all the necessary files in the right places.<br />
<br />
Getting the emitter working in Websphere should not be difficult, but I don't know Websphere, I've never used BIRT in an OSGi container other than eclipse, and I'm not getting any information that helps. All very frustrating, and more so for you, I'm sure.<br />
<br />
There are four possibilities, as I see it:<br />
<ul class='bbc'><li>BIRT can't see my jar.</li><li>BIRT can't see one of the dependencies for my jar.</li><li>There is some collision between my dependencies and your container.</li><li>Something else is breaking when Websphere tries to initialise my jar.</li></ul>
<br />
For the first one, my jar needs to be n the same place a the other BIRT plugins.<br />
For the second, in eclipse nothing needs to be done, but in a POJO configuration the dependencies for my emitter need to be pulled out of my jar and put in the same folder as my jar - I don't know about Websphere, but try both ways.<br />
For the last two the only hope is that something is being logged.<br />
<br />
Are you getting logs from BIRT?<br />
If not, can you reconfigure so you do?<br />
<br />
Jim
krusifier
<blockquote class='ipsBlockquote' data-author="'Yaytay'" data-cid="115425" data-time="1364326195" data-date="26 March 2013 - 12:29 PM"><p>
Well, you could try a completely different format.<br />
BIRT 4 includes emitters for OpenOffice, that I think Excel should be able to open - I don't know much more about them than that though.<br />
<br />
The built-in text emitters won't work very well with crosstabs (because they are data extraction processes, not really emitters).<br />
I think there are plugin emitters for CSV output, and for XML output, either of which should get the crosstabs data out, minus any formatting - but you are still left needing to get custom emitters working.<br />
<br />
The XLS format is inherently limited to about 250 columns. XLSX breaks that limit, but you'll need a custom emitter to get that.<br />
<br />
Jim<br /></p></blockquote>
<br />
I've tried working with ODS(open document spreadsheet) but it gives a horrible unindented view which nobody could understand in the first go, so open office is out of question. Tell me one thing,do we need an external excel emitter if we want a page break after 250 columns, because i tried page break and even it is not working in excel but working in pdf,webviewer,etc?
Yaytay
<blockquote class='ipsBlockquote' data-author="'krusifier'" data-cid="115478" data-time="1364444075" data-date="27 March 2013 - 09:14 PM"><p>
I've tried working with ODS(open document spreadsheet) but it gives a horrible unindented view which nobody could understand in the first go, so open office is out of question. Tell me one thing,do we need an external excel emitter if we want a page break after 250 columns, because i tried page break and even it is not working in excel but working in pdf,webviewer,etc?<br /></p></blockquote>
I'm afraid I don't know, it's been a while since I've used the built-in emitter.<br />
<br />
I <em class='bbc'>thought</em> it didn't even support multiple sheets, in which case there is no way past the 250 limit at all, but I may be wrong about that.<br />
<br />
Jim
krusifier
<blockquote class='ipsBlockquote' data-author="'Yaytay'" data-cid="115426" data-time="1364326857" data-date="26 March 2013 - 12:40 PM"><p>
What I'm trying to see if the files, not the folders. <br />
I need to know that you've got all the necessary files in the right places.<br />
<br />
Getting the emitter working in Websphere should not be difficult, but I don't know Websphere, I've never used BIRT in an OSGi container other than eclipse, and I'm not getting any information that helps. All very frustrating, and more so for you, I'm sure.<br />
<br />
There are four possibilities, as I see it:<br />
<ul class='bbc'><li>BIRT can't see my jar.</li><li>BIRT can't see one of the dependencies for my jar.</li><li>There is some collision between my dependencies and your container.</li><li>Something else is breaking when Websphere tries to initialise my jar.</li></ul>
<br />
For the first one, my jar needs to be n the same place a the other BIRT plugins.<br />
For the second, in eclipse nothing needs to be done, but in a POJO configuration the dependencies for my emitter need to be pulled out of my jar and put in the same folder as my jar - I don't know about Websphere, but try both ways.<br />
For the last two the only hope is that something is being logged.<br />
<br />
Are you getting logs from BIRT?<br />
If not, can you reconfigure so you do?<br />
<br />
Jim<br /></p></blockquote>
<br />
hey JIM,<br />
1st option can be ruled out because the server from which i am calling excel is showing a code hint of Xlsxemitter, it means servlet is reading the JAR.<br />
2nd option is ruled out because i am doing what it is written above(the dependencies for my emitter need to be pulled out of my jar and put in the same folder as my jar)<br />
3rd and 4th options may not be ruled out because i can't figure out where is my log placed in which folder exactly.<br />
help me out on options 3 and 4 because i've searched many folders but could'nt find any log files.
Yaytay
<blockquote class='ipsBlockquote' data-author="'krusifier'" data-cid="115514" data-time="1364561325" data-date="29 March 2013 - 05:48 AM"><p>
hey JIM,<br />
1st option can be ruled out because the server from which i am calling excel is showing a code hint of Xlsxemitter, it means servlet is reading the JAR.<br />
2nd option is ruled out because i am doing what it is written above(the dependencies for my emitter need to be pulled out of my jar and put in the same folder as my jar)<br />
3rd and 4th options may not be ruled out because i can't figure out where is my log placed in which folder exactly.<br />
help me out on options 3 and 4 because i've searched many folders but could'nt find any log files.<br /></p></blockquote>
What "code hint" are you seeing?<br />
<br />
I'm afraid the log files are dependent on both WebSphere and your configuration of the war that you are using, neither of which I know about.<br />
<br />
Jim
krusifier
<blockquote class='ipsBlockquote' data-author="'Yaytay'" data-cid="115520" data-time="1364569334" data-date="29 March 2013 - 08:02 AM"><p>
What "code hint" are you seeing?<br />
<br />
I'm afraid the log files are dependent on both WebSphere and your configuration of the war that you are using, neither of which I know about.<br />
<br />
Jim<br /></p></blockquote>
<br />
Hey JIM,<br />
The code hint which i am talking about was when i write xlsx it automatically shows me xlsxEmitter it means it is reading the class file because xlsx emitter wasn't there in default file.
Yaytay
<blockquote class='ipsBlockquote' data-author="'krusifier'" data-cid="115582" data-time="1364797324" data-date="31 March 2013 - 11:22 PM"><p>
Hey JIM,<br />
The code hint which i am talking about was when i write xlsx it automatically shows me xlsxEmitter it means it is reading the class file because xlsx emitter wasn't there in default file.<br /></p></blockquote>
I don't know WebSphere, but isn't that the design-time environment, and which is not necessarily using the same classpath/loaders as the runtime environment?<br />
<br />
You really need help from someone who has got custom plugins working WebSphere.<br />
<br />
Jim
krusifier
<blockquote class='ipsBlockquote' data-author="'Yaytay'" data-cid="115595" data-time="1364834587" data-date="01 April 2013 - 09:43 AM"><p>
I don't know WebSphere, but isn't that the design-time environment, and which is not necessarily using the same classpath/loaders as the runtime environment?<br />
<br />
You really need help from someone who has got custom plugins working WebSphere.<br />
<br />
Jim<br /></p></blockquote>
<br />
Hey Jim,<br />
Thanks a lot for helping me out,that's a wonderful gesture. I will continue to dig it more and more till i find a feasible solution.<br />
<br />
Karan