Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » BIRT » Export report as csv (unicode)
Export report as csv (unicode) [message #635861] Thu, 28 October 2010 11:52 Go to next message
Luboslav  is currently offline Luboslav
Messages: 4
Registered: October 2010
Junior Member
Hello,
I use birt-runtime-2_3_2,I export data with CSVRenderOption to csv file,but the unicode characters like 'Ü' are becomes "Ãœ".It is problem from CSVRenderOption,parsing or exel,any idea?

Regards,

Lubo
Re: Export report as csv (unicode) [message #635871 is a reply to message #635861] Thu, 28 October 2010 12:50 Go to previous messageGo to next message
Eclipse User
Originally posted by: thilo.bruesshaber.gmail.com

Excel

Am 28.10.2010 13:52, schrieb Luboslav:
> Hello,
> I use birt-runtime-2_3_2,I export data with CSVRenderOption to csv
> file,but the unicode characters like 'Ü' are becomes "Ãœ".It is problem
> from CSVRenderOption,parsing or exel,any idea?
>
> Regards,
>
> Lubo
Re: Export report as csv (unicode) [message #635873 is a reply to message #635871] Thu, 28 October 2010 13:05 Go to previous messageGo to next message
Luboslav  is currently offline Luboslav
Messages: 4
Registered: October 2010
Junior Member
Are you sure?Exel,but how to fix that problem?It is depents on version or plugin?Here is my code for export :


public void executeReportCsvDataExtraction(String strReportsDirectory,String strReportName,String strParameters) throws Exception
{
try
{
Log4J.infoout(String.valueOf(m_objReportEngine));
IReportRunnable design = m_objReportEngine.openReportDesign(strReportsDirectory+File. separator+strReportName+ ".rptdesign");

IGetParameterDefinitionTask paramtask = m_objReportEngine.createGetParameterDefinitionTask( design );
Collection clParameters = paramtask.getParameterDefns( true );

ReportDesignHandle designHandle = (ReportDesignHandle) design.getDesignHandle( );
ElementFactory designFactory = designHandle.getElementFactory( );
buildDataSource(designFactory, designHandle);
designHandle.close();

//Create task to run and render the report,
IRunAndRenderTask task = m_objReportEngine.createRunAndRenderTask(design);

Hashtable htParameters=new Hashtable();
StringTokenizer objParametersTokenizer=new StringTokenizer(strParameters,"&");

String strParameter;

int iIndex;
for(;objParametersTokenizer.hasMoreTokens()Wink
{
strParameter=objParametersTokenizer.nextToken();
iIndex=strParameter.indexOf('=');
if (iIndex>-1)
{
htParameters.put(strParameter.substring(0,iIndex),
strParameter.substring(iIndex+1));
}
}

Iterator iter = clParameters.iterator();
IParameterDefnBase param;
IScalarParameterDefn scalar;
String strParameterValue;
while ( iter.hasNext( ) )
{
param = (IParameterDefnBase) iter.next( );
if ( param instanceof IScalarParameterDefn )
{
scalar = (IScalarParameterDefn) param;
strParameterValue=String.valueOf(htParameters.get(scalar.get Name()));
switch (scalar.getDataType())
{
case IScalarParameterDefn.TYPE_INTEGER:
case IScalarParameterDefn.TYPE_DECIMAL:
task.setParameterValue(scalar.getName(),Integer.parseInt(str ParameterValue));
break;
default:

String a=(String) htParameters.get(scalar.getName());


task.setParameterValue(scalar.getName(),a);
break;
}
}
}

task.validateParameters();

CSVRenderOption csvOptions = new CSVRenderOption();

csvOptions.setOutputFormat( "CSV" );
csvOptions.setOutputFileName("c:/csvReport.csv");

task.setRenderOption( csvOptions );

task.run();

task.close();
}
catch( Exception ex)
{
ex.printStackTrace();
throw ex;
}
}

[Updated on: Thu, 28 October 2010 13:17]

Report message to a moderator

Re: Export report as csv (unicode) [message #637663 is a reply to message #635861] Mon, 08 November 2010 09:35 Go to previous messageGo to next message
Luboslav  is currently offline Luboslav
Messages: 4
Registered: October 2010
Junior Member
Any idea?
Re: Export report as csv (unicode) [message #637735 is a reply to message #637663] Mon, 08 November 2010 15:24 Go to previous messageGo to next message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Can you open a bug for this? BTW are you setting the locale before the
render operation?

Jason


On 11/8/2010 4:35 AM, Luboslav wrote:
> Any idea?
Re: Export report as csv (unicode) [message #638422 is a reply to message #637735] Thu, 11 November 2010 09:36 Go to previous messageGo to next message
Luboslav  is currently offline Luboslav
Messages: 4
Registered: October 2010
Junior Member
You can see my code,i don`t make any changes with locale,but which locale?csvOptions.LOCALE?How to set this locale or maybe you talk about computer settings?
Re: Export report as csv (unicode) [message #638539 is a reply to message #638422] Thu, 11 November 2010 15:13 Go to previous message
Jason Weathersby is currently offline Jason Weathersby
Messages: 9167
Registered: July 2009
Senior Member

Can you post your code?

Jason

On 11/11/2010 4:36 AM, Luboslav wrote:
> You can see my code,i don`t make any changes with locale,but which
> locale?csvOptions.LOCALE?How to set this locale or maybe you talk about
> computer settings?
Previous Topic:Internal exception with Highlight, 2.6.1
Next Topic:Split column
Goto Forum:
  


Current Time: Sun Sep 21 00:22:02 GMT 2014

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

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