how to change export file name [message #893683] |
Thu, 05 July 2012 05:09  |
Eclipse User |
|
|
|
birt 2.3.x
<context-param>
<param-name>BIRT_FILENAME_GENERATOR_CLASS</param-name>
<param-value>com.link.report.FilenameGenerator</param-value>
</context-param>
package jetsennet.jnmp.report;
import java.util.Date;
import java.util.Map;
import org.eclipse.birt.report.utility.filename.IFilenameGenerator;
public class FilenameGenerator implements IFilenameGenerator
{
/**
* default report file name
*/
public static final String DEFAULT_FILENAME = "report";
public String getFilename(String [b]fileName[/b], String extension,
String outputType, Map options)
{
System.out.println(baseName);
return makeFileName(baseName, extension);
}
/**
* Makes a filename using the target extension from the options.
*
* @param fileName
* file name which extension must be replaced
* @return file name with replaced extension
*/
public static String makeFileName(String fileName, String extensionName)
{
String baseName = fileName;
if (baseName == null || baseName.trim().length() <= 0)
{
baseName = DEFAULT_FILENAME;
}
// check whether the file name contains non US-ASCII characters
for (int i = 0; i < baseName.length(); i++)
{
char c = baseName.charAt(i);
// char is from 0-127
if (c < 0x00 || c >= 0x80)
{
baseName = DEFAULT_FILENAME;
break;
}
}
// append extension name
if (extensionName != null && extensionName.length() > 0)
{
baseName += (new Date()).toString() + "." + extensionName; //$NON-NLS-1$
}
return baseName;
}
}
I'd like to use the follow code, but it is unusable!
<birt:viewer id="birtViewer" reportDesign="reports/alarmeventstatisticsnew.rptdesign"
pattern="frameset"
format="HTML"
isHostPage = "true">
<birt:param name="baseName" value="myexportfile"/>
</birt:viewer>
how to change baseName, or how to pass parameter to baseName?
[Updated on: Thu, 05 July 2012 06:13] by Moderator
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.33523 seconds