Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Open an excel URL in new window without calling an action

Former Member
0 Kudos

Hi

I have a project in which I have a button and link to URL as table tool bar element.

I am able to generate an excel on click of a button and this excel opens when I click on link to URL.

Requirement is to open the excel sheet on click of button without having to click on link to URL.

I am able to transfer table data to excel sheet and I am also able to generate the URL.

But, I am not able to open this URL directly without clicking on the link to URL.

Can any one help? I need to open the excel sheet in single click.

My code is as below

IWDResource cachedExcelResource = null;


   //Create File
   File f = new File("Name of Excel");

 

//Create workbook
   WritableWorkbook workbook = Workbook.createWorkbook(f);

 

//Create sheet
   WritableSheet sheet = workbook.createSheet("First Sheet", 0);

// Code to transfer table data to excel sheet.

workbook.setColourRGB(Colour.LIME, 0xff, 0, 0);
 

workbook.write(); 
  
    FileInputStream excelCSVFile = new FileInputStream(f);
   
    cachedExcelResource =
     getCachedWebResource(
      excelCSVFile,
      "Name of Excel",
      WDWebResourceType.XLS);

   
    wdContext.currentContextElement().setResource(cachedExcelResource);
   

String url = cachedExcelResource.getUrl(WDFileDownloadBehaviour.ALLOW_SAVE.ordinal());

    wdContext.currentContextElement().setContextExcelAttribute(url);

           IWDWindow window =
                   wdComponentAPI
                         .getWindowManager().createNonModalExternalWindow(url);

             window.show();

    workbook.close();

2 REPLIES 2

Sharathmg
Active Contributor
0 Kudos

Is the issue resolved? Were you able to find the solution?

Former Member
0 Kudos

Hi

I was able to fix the issue on my own.

I called the button action in the code to populate table data. This way I was able to avoid the extra action of clicking a button.

It solved my purpose.

Regards

Vineet