cancel
Showing results for 
Search instead for 
Did you mean: 

Export to Excel file name

Former Member
0 Kudos

Hi,

When i export my table contents to MS Excel the name of the excel file is CAHWJARD.xls and i am not getting the file name which i have mentioned in export to excel code.In Internet Explorer 6.0 i am facing this problem, but in IE 7.0 the name of the Excel file is coming correctly.

Please help me in solving this problem with IE 6.0.

Regards,

Bala Baskaran.S

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

try this code to getbthe path of the file. and to store the file.

File file=new File("CAHWJARD.xls");
	FileOutputStream out; // declare a file output object
			PrintStream p; // declare a print stream object

			try
			{
					// Create a new file output stream
					// connected to "myfile.txt"
					out = new FileOutputStream(file);
					// Connect print stream to the output stream
					p = new PrintStream(out);
                    			p.println ("Leave form");
					p.println("Employe id is--------   "+str1+"\n");
					p.println("Employe name is------   "+Str2+"\n");
					p.println("Start date-----------   "+Str3+"\n");
					p.println("End date-------------   "+Str4+"\n");
					p.println("No of working days---   "+Str5+"\n");
				resourcePath =
					  WDURLGenerator.getResourcePath(
						wdComponentAPI.getDeployableObjectPart(),
						str6);
			 path = file.getAbsolutePath();

					p.close();
			}
			catch (Exception e)
			{
					wdComponentAPI.getMessageManager().reportException("Error writing to file",false);
			}

try{
String resourcePath;
	String path;	
resourcePath = WDURLGenerator.getResourcePath(							wdComponentAPI.getDeployableObjectPart(),"CAHWJARD.xls");
	path = file.getAbsolutePath();
	wdComponentAPI.getMessageManager().reportSuccess(path.toString());
}catch(Exception e)
{
	e.printStackTrace();
}

Regards,

H.V.Swathi

Former Member
0 Kudos

Dear Bala,

I have also implemented export to excel with 6.0 version only and it is working fine.

Make sure that you have exported all the jxl jars and also copied the jxl jar into lib folder of your project.

For refrence just refer to the code below:

String fileName = "Tickets" + ".xls";

IWDCachedWebResource cachedExcelResource = null;

try {

try {

File f = new File("Tickets.xls");

WritableWorkbook workbook;

workbook = Workbook.createWorkbook(f);

}

}

chander_kararia4
Contributor
0 Kudos

Hi Anupama,

I suppose in this case, the code is not affecting anything coz the results are coming as desired with version 7. Well, I am not sure but...

Bala,

There might be some other problem. Try with deleting the cookies & set the security & privacy level to low.

That might work out the things.

Regards

Chander Kararia

Former Member
0 Kudos

Ya i agree with this ,but still sometimes jxl will craete this type of problems.

Also my code is working for 7.0 version also.May be it can be cookie problem.

@Bala :just check with that also.

Regards,

Anupama