cancel
Showing results for 
Search instead for 
Did you mean: 

Show download popup and obtain path directory chosen by the user

Former Member
0 Kudos

Hello all,

I want to show a typical window for downloading a file, where the user select the directory she/he want and give the file a name. Then, save in a string attribute to the path and file name chosen by the user.

In this way, i already have the path to save the excel i created on the PC client.

Best Regards,

Jennifer Lohan.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos
Former Member
0 Kudos

Hello Ayyapparaj,

I used the library JExcelApi. The code I use to generate the excel is as follows, where I need to include in the PATH variable the directory where the user want to save the file.

What I need is to show the window for the user to choose where they want to save the excel file and overwrite the variable path.

How do I do? Any sample code to make the save browse and get the path?

(Example: C:\Documents and Settings\All Users...etc)

try
	{
		//Set path
		String path = "Example.xls";
		File fich = new File(path);
                
                //Creating Workbook.
		WritableWorkbook workbook = Workbook.createWorkbook(fich);

		//Creating sheet.
		WritableSheet sheet = workbook.createSheet("SheetExample", 0);  
			
		//Fill headers columns.
		sheet.addCell(new jxl.write.Label(0,0,"Name"));
		sheet.addCell(new jxl.write.Label(1,0,"Last Name"));
		sheet.addCell(new jxl.write.Label(2,0,"Amount"));
			
		// Fill cells.
		sheet.addCell(new jxl.write.Label(0, 1, "John"));
		sheet.addCell(new jxl.write.Label(1, 1, "Smith")); 
		sheet.addCell(new jxl.write.Number(2, 1, 1.20)); 
			
		//Enter the result in the excel file.
		workbook.write();
		workbook.close();   
			
		System.out.println("Complete example.");  
		}
		catch (IOException ex) 
		{ 
			System.out.println("Failed to create file."); 
		} 
		catch (WriteException ex) 
		{ 
			System.out.println("Error writing file."); 
		}

Best Regards,

Jennifer Lohan.

Former Member
0 Kudos

Hello all,

I found this link on how to do it.

https://www.sdn.sap.com/irj/scn/wiki?path=/display/snippets/webDynproJava-ExportingTableDataUsingOn-DemandStreams-SAPNW+7.0

But the file that creates an xml. Is there any way to display the Save Dialog PopUp like this "Do you

want to open or save this file?" and get the route chosen by the user? So I will use the library jExcelApi.

Best Regards,

Jennifer Lohan.

Former Member
0 Kudos

Thanks Armin,

but how to apply this to my previous code?

Can you explain a little example code?

Best Regards,

Jennifer Lohan.

Former Member
0 Kudos

Use IWDFileDownload UI element and set "behaviour" property to WDFileDownloadBehaviour.ALLOW_SAVE.

Armin