Skip to Content
author's profile photo Former Member
Former Member

Open an excel URL in new window without calling an action

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

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Posted on Sep 03, 2013 at 08:22 AM

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

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.