Quantcast
Channel: SCN: Message List
Viewing all articles
Browse latest Browse all 10482

Open an excel URL in new window without calling an action

$
0
0

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();


Viewing all articles
Browse latest Browse all 10482

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>