Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » How to save report to excel or pdf silently in server or client PC
How to save report to excel or pdf silently in server or client PC [message #722571] Tue, 06 September 2011 08:24 Go to next message
cbr125x  is currently offline cbr125x
Messages: 34
Registered: July 2011
Member
Hi all,
Is there a way to save or export report to pdf or excel silently in server or client PC?

Thanks
Re: How to save report to excel or pdf silently in server or client PC [message #722710 is a reply to message #722571] Tue, 06 September 2011 14:38 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Can you give some more detail? Do you want as a user views the report
in html the server to generate a pdf copy somewhere?

Jason

On 9/6/2011 4:24 AM, cbr125x wrote:
> Hi all,
> Is there a way to save or export report to pdf or excel silently in
> server or client PC?
>
> Thanks
Re: How to save report to excel or pdf silently in server or client PC [message #722861 is a reply to message #722710] Wed, 07 September 2011 01:28 Go to previous messageGo to next message
cbr125x  is currently offline cbr125x
Messages: 34
Registered: July 2011
Member
Thanks Jason for reply,
yes, i want to generate the report that i made by BIRT into PDF file, and save the file in the server local drive or client local drive (which i already granted permission to write).
Let's say i want to generate the report in pdf file at C:\PDF\ or at \\server1\PDF\
is there a way to do that?



Jason Weathersby wrote on Tue, 06 September 2011 10:38
Can you give some more detail? Do you want as a user views the report
in html the server to generate a pdf copy somewhere?

Jason

On 9/6/2011 4:24 AM, cbr125x wrote:
> Hi all,
> Is there a way to save or export report to pdf or excel silently in
> server or client PC?
>
> Thanks

Re: How to save report to excel or pdf silently in server or client PC [message #723540 is a reply to message #722861] Thu, 08 September 2011 18:39 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Are you using the RE API or the BIRT Viewer?

Jason

On 9/6/2011 9:28 PM, cbr125x wrote:
> Thanks Jason for reply,
> yes, i want to generate the report that i made by BIRT into PDF file,
> and save the file in the server local drive or client local drive (which
> i already granted permission to write).
> Let's say i want to generate the report in pdf file at C:\PDF\ or at
> \\server1\PDF\
> is there a way to do that?
>
>
>
> Jason Weathersby wrote on Tue, 06 September 2011 10:38
>> Can you give some more detail? Do you want as a user views the report
>> in html the server to generate a pdf copy somewhere?
>>
>> Jason
>>
>> On 9/6/2011 4:24 AM, cbr125x wrote:
>> > Hi all,
>> > Is there a way to save or export report to pdf or excel silently in
>> > server or client PC?
>> >
>> > Thanks
>
>
Re: How to save report to excel or pdf silently in server or client PC [message #723620 is a reply to message #723540] Fri, 09 September 2011 01:23 Go to previous messageGo to next message
cbr125x  is currently offline cbr125x
Messages: 34
Registered: July 2011
Member
actually i'm not really sure what method i use, i think it is BIRT Viewer, i put the "webviewerExample" in the tomcat server, is it Viewer?

can i you explain me too about the RE API?

Thanks

Jason Weathersby wrote on Thu, 08 September 2011 14:39
Are you using the RE API or the BIRT Viewer?

Jason

On 9/6/2011 9:28 PM, cbr125x wrote:
> Thanks Jason for reply,
> yes, i want to generate the report that i made by BIRT into PDF file,
> and save the file in the server local drive or client local drive (which
> i already granted permission to write).
> Let's say i want to generate the report in pdf file at C:\PDF\ or at
> \\server1\PDF\
> is there a way to do that?
>
>
>
> Jason Weathersby wrote on Tue, 06 September 2011 10:38
>> Can you give some more detail? Do you want as a user views the report
>> in html the server to generate a pdf copy somewhere?
>>
>> Jason
>>
>> On 9/6/2011 4:24 AM, cbr125x wrote:
>> > Hi all,
>> > Is there a way to save or export report to pdf or excel silently in
>> > server or client PC?
>> >
>> > Thanks
>
>

Re: How to save report to excel or pdf silently in server or client PC [message #724557 is a reply to message #723620] Mon, 12 September 2011 14:16 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

That is the viewer. You could write some script in the report that
would save the report to the server in a different format while the user
is viewing it in HTML. Is that what you want?

Jason

On 9/8/2011 9:23 PM, cbr125x wrote:
> actually i'm not really sure what method i use, i think it is BIRT
> Viewer, i put the "webviewerExample" in the tomcat server, is it Viewer?
>
> can i you explain me too about the RE API?
>
> Thanks
>
> Jason Weathersby wrote on Thu, 08 September 2011 14:39
>> Are you using the RE API or the BIRT Viewer?
>>
>> Jason
>>
>> On 9/6/2011 9:28 PM, cbr125x wrote:
>> > Thanks Jason for reply,
>> > yes, i want to generate the report that i made by BIRT into PDF file,
>> > and save the file in the server local drive or client local drive
>> (which
>> > i already granted permission to write).
>> > Let's say i want to generate the report in pdf file at C:\PDF\ or at
>> > \\server1\PDF\
>> > is there a way to do that?
>> >
>> >
>> >
>> > Jason Weathersby wrote on Tue, 06 September 2011 10:38
>> >> Can you give some more detail? Do you want as a user views the report
>> >> in html the server to generate a pdf copy somewhere?
>> >>
>> >> Jason
>> >>
>> >> On 9/6/2011 4:24 AM, cbr125x wrote:
>> >> > Hi all,
>> >> > Is there a way to save or export report to pdf or excel silently in
>> >> > server or client PC?
>> >> >
>> >> > Thanks
>> >
>> >
>
>
Re: How to save report to excel or pdf silently in server or client PC [message #724731 is a reply to message #724557] Tue, 13 September 2011 01:27 Go to previous messageGo to next message
cbr125x  is currently offline cbr125x
Messages: 34
Registered: July 2011
Member
Yes, that is what i want, what script i should write?

Jason Weathersby wrote on Mon, 12 September 2011 10:16 :
That is the viewer. You could write some script in the report that
would save the report to the server in a different format while the user
is viewing it in HTML. Is that what you want?

Jason

On 9/8/2011 9:23 PM, cbr125x wrote:
> actually i'm not really sure what method i use, i think it is BIRT
> Viewer, i put the "webviewerExample" in the tomcat server, is it Viewer?
>
> can i you explain me too about the RE API?
>
> Thanks
>
> Jason Weathersby wrote on Thu, 08 September 2011 14:39
>> Are you using the RE API or the BIRT Viewer?
>>
>> Jason
>>
>> On 9/6/2011 9:28 PM, cbr125x wrote:
>> > Thanks Jason for reply,
>> > yes, i want to generate the report that i made by BIRT into PDF file,
>> > and save the file in the server local drive or client local drive
>> (which
>> > i already granted permission to write).
>> > Let's say i want to generate the report in pdf file at C:\PDF\ or at
>> > \\server1\PDF\
>> > is there a way to do that?
>> >
>> >
>> >
>> > Jason Weathersby wrote on Tue, 06 September 2011 10:38
>> >> Can you give some more detail? Do you want as a user views the report
>> >> in html the server to generate a pdf copy somewhere?
>> >>
>> >> Jason
>> >>
>> >> On 9/6/2011 4:24 AM, cbr125x wrote:
>> >> > Hi all,
>> >> > Is there a way to save or export report to pdf or excel silently in
>> >> > server or client PC?
>> >> >
>> >> > Thanks
>> >
>> >
>
>
Re: How to save report to excel or pdf silently in server or client PC [message #725008 is a reply to message #724731] Tue, 13 September 2011 17:52 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

I am attaching an example of a report that creates a pdf for every row
in a detail table. Look at the table row oncreate to get an idea on how
to call the api from script. In your case you can put the script in the
afterFactory of the report.

Jason

On 9/12/2011 9:27 PM, cbr125x wrote:
> Yes, that is what i want, what script i should write?
>
> Jason Weathersby wrote on Mon, 12 September 2011 10:16 :
> That is the viewer. You could write some script in the report that would
> save the report to the server in a different format while the user is
> viewing it in HTML. Is that what you want?
>
> Jason
>
> On 9/8/2011 9:23 PM, cbr125x wrote:
>> actually i'm not really sure what method i use, i think it is BIRT
>> Viewer, i put the "webviewerExample" in the tomcat server, is it Viewer?
>>
>> can i you explain me too about the RE API?
>>
>> Thanks
>>
>> Jason Weathersby wrote on Thu, 08 September 2011 14:39
>>> Are you using the RE API or the BIRT Viewer?
>>>
>>> Jason
>>>
>>> On 9/6/2011 9:28 PM, cbr125x wrote:
>>> > Thanks Jason for reply,
>>> > yes, i want to generate the report that i made by BIRT into PDF file,
>>> > and save the file in the server local drive or client local drive
>>> (which
>>> > i already granted permission to write).
>>> > Let's say i want to generate the report in pdf file at C:\PDF\ or at
>>> > \\server1\PDF\
>>> > is there a way to do that?
>>> >
>>> >
>>> >
>>> > Jason Weathersby wrote on Tue, 06 September 2011 10:38
>>> >> Can you give some more detail? Do you want as a user views the report
>>> >> in html the server to generate a pdf copy somewhere?
>>> >>
>>> >> Jason
>>> >>
>>> >> On 9/6/2011 4:24 AM, cbr125x wrote:
>>> >> > Hi all,
>>> >> > Is there a way to save or export report to pdf or excel silently in
>>> >> > server or client PC?
>>> >> >
>>> >> > Thanks
>>> >
>>> >
>>
>>
>
  • Attachment: burst.zip
    (Size: 5.53KB, Downloaded 250 times)
Re: How to save report to excel or pdf silently in server or client PC [message #725173 is a reply to message #725008] Wed, 14 September 2011 07:02 Go to previous messageGo to next message
cbr125x  is currently offline cbr125x
Messages: 34
Registered: July 2011
Member
Thx Jason for keep replying my question.
i already test the example u gave me. it generate pdf successfuly.
but i did not succeed implement the script in my report.
i try to describe the example u gave, sorry if i was wrong.

in the report it seeems we have to report "burstpdf" and "burstDetail".
when we called the "burstpdf" report then we generate the "burstDetail" report to pdf into "c:temp".
how about if i want to generate the burstpdf only?

i try to put this script in the afterFactory Events in report design
importPackage(Packages.org.eclipse.birt.report.engine.api);
var re = reportContext.getReportRunnable().getReportEngine();
var des = re.openReportDesign("C:/Testing/ABC.rptdesign"); //--> Let's say i have ABC.rptdesign
var ntask = re.createRunAndRenderTask(des);
var options = new PDFRenderOption();
var outputfile = "c:/temp/test1.pdf";
options.setOutputFileName(outputfile);
options.setOutputFormat("pdf");
ntask.setRenderOption(options);
ntask.run();
ntask.close();

the viewer become not responding. but when i comment the
//ntask.run();
//ntask.close();

The report run successfuly but the pdf is still not created.

can u help me in which script i must change?
Thx Again

Jason Weathersby wrote on Tue, 13 September 2011 13:52
I am attaching an example of a report that creates a pdf for every row
in a detail table. Look at the table row oncreate to get an idea on how
to call the api from script. In your case you can put the script in the
afterFactory of the report.

Jason

[Updated on: Wed, 14 September 2011 07:03]

Report message to a moderator

Re: How to save report to excel or pdf silently in server or client PC [message #725382 is a reply to message #725173] Wed, 14 September 2011 15:25 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

My guess is that you have a nested chase condition. You are calling a
report that generates a pdf which in itself is generating another pdf
and on and on and on..

Look at the attached example where I use a hidden parameter to make sure
this does not happen. BTW I just did the pdf generation in the
beforeFactory.

Jason

On 9/14/2011 3:02 AM, cbr125x wrote:
> importPackage(Packages.org.eclipse.birt.report.engine.api);
> var re = reportContext.getReportRunnable().getReportEngine();
> var des = re.openReportDesign("C:/Testing/ABC.rptdesign"); var ntask =
> re.createRunAndRenderTask(des);
> var options = new PDFRenderOption();
> var outputfile = "c:/temp/test1.pdf";
> options.setOutputFileName(outputfile);
> options.setOutputFormat("pdf");
> ntask.setRenderOption(options);
> ntask.run();
> ntask.close();
Re: How to save report to excel or pdf silently in server or client PC [message #725508 is a reply to message #725382] Thu, 15 September 2011 02:07 Go to previous messageGo to next message
cbr125x  is currently offline cbr125x
Messages: 34
Registered: July 2011
Member
thx Jason it works now. but i have some questions.
1. I tried not to use the parameter, PDF file is generated but it takes long time than we use parameter. why should we use parameter?
2. what is the different with after factory and before factory?



Jason Weathersby wrote on Wed, 14 September 2011 11:25
My guess is that you have a nested chase condition. You are calling a
report that generates a pdf which in itself is generating another pdf
and on and on and on..

Look at the attached example where I use a hidden parameter to make sure
this does not happen. BTW I just did the pdf generation in the
beforeFactory.

Jason

On 9/14/2011 3:02 AM, cbr125x wrote:
> importPackage(Packages.org.eclipse.birt.report.engine.api);
> var re = reportContext.getReportRunnable().getReportEngine();
> var des = re.openReportDesign("C:/Testing/ABC.rptdesign"); var ntask =
> re.createRunAndRenderTask(des);
> var options = new PDFRenderOption();
> var outputfile = "c:/temp/test1.pdf";
> options.setOutputFileName(outputfile);
> options.setOutputFormat("pdf");
> ntask.setRenderOption(options);
> ntask.run();
> ntask.close();

Re: How to save report to excel or pdf silently in server or client PC [message #725677 is a reply to message #725508] Thu, 15 September 2011 13:46 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

It does not matter if you do it in the beforeFactory or afterFactory.
The reason it is taking longer without the parameter is it is trying to
run the report a bunch of times. Every time you call the report it will
create the pdf which is circular logic.

Jason

On 9/14/2011 10:07 PM, cbr125x wrote:
> thx Jason it works now. but i have some questions. 1. I tried not to use
> the parameter, PDF file is generated but it takes long time than we use
> parameter. why should we use parameter?
> 2. what is the different with after factory and before factory?
>
>
>
> Jason Weathersby wrote on Wed, 14 September 2011 11:25
>> My guess is that you have a nested chase condition. You are calling a
>> report that generates a pdf which in itself is generating another pdf
>> and on and on and on..
>>
>> Look at the attached example where I use a hidden parameter to make
>> sure this does not happen. BTW I just did the pdf generation in the
>> beforeFactory.
>>
>> Jason
>>
>> On 9/14/2011 3:02 AM, cbr125x wrote:
>> > importPackage(Packages.org.eclipse.birt.report.engine.api);
>> > var re = reportContext.getReportRunnable().getReportEngine();
>> > var des = re.openReportDesign("C:/Testing/ABC.rptdesign"); var ntask =
>> > re.createRunAndRenderTask(des);
>> > var options = new PDFRenderOption();
>> > var outputfile = "c:/temp/test1.pdf";
>> > options.setOutputFileName(outputfile);
>> > options.setOutputFormat("pdf");
>> > ntask.setRenderOption(options);
>> > ntask.run();
>> > ntask.close();
>
>
Re: How to save report to excel or pdf silently in server or client PC [message #1064752 is a reply to message #725677] Thu, 20 June 2013 20:02 Go to previous message
josh t is currently offline josh t
Messages: 1
Registered: June 2013
Junior Member
Hi Jason,

I used the following code to save the birt report as a PDF in Java.
I'm able to save the pdf file. But, I cannot delete the file because it is still in use. Do you know any workaround for this?

IReportDocument rptDoc = engine.openReportDocument(docname);
IRenderTask renderTask = engine.createRenderTask(rptDoc);
RenderOption options = new PDFRenderOption();
options.setOutputFormat("pdf");
File tempReportFile = new File(filename);
String tempReportCanonicalPath = tempReportFile.getCanonicalPath();
options.setOutputFileName(tempReportCanonicalPath);
renderTask.setRenderOption(options);
renderTask.render();
renderTask.close();
rptDoc.close();
reportDesignHandle.close();
//Some processing is done here (but no file handles opened)

//Never able to delete the file because it is in use by some BIRT Class (I think)
if(tempReportFile.delete()) {
logger.debug("delete success");
}
else {
logger.debug("delete fail");
}
Previous Topic:Maximo-BIRT Previous or Next Record
Next Topic:Sorting bar chart based on y-axis values
Goto Forum:
  


Current Time: Sun Sep 21 18:28:56 GMT 2014

Powered by FUDForum. Page generated in 0.03945 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software