We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Launching Excel workbook in an existing running instance of MSExcel

Thread ID:

Created:

Updated:

Platform:

Replies:

75892 Aug 13,2008 02:48 PM Sep 8,2008 09:45 AM Windows Forms 13
loading
Tags: XlsIO
Swamidas Dalvi
Asked On August 13, 2008 02:48 PM

I'm wondering if it is possible to do the above either in ExcelIO or ExcelRW. My experience is that the call to
ExcelEngine e = new ExcelEngine();
always creates a new instance of the application and opens the workbook inside that. Any tweaks or undocumented features that could help?


Yavanaarasi G [Syncfusion]
Replied On August 14, 2008 06:41 AM

Hi Swamidas,

Thank you for your interest in Syncfusion products.

If your intention is to open the excel file through XlsIO which is already opened you can use "openreadonly" method.

Here is the code snippet:

[C#]
IWorkbook myWorkbook = excelEngine.Excel.Workbooks.OpenReadOnly("Test.xls");


Also, please refer the below codesnippet to know how to add workbooks in Excelengine.


// New instance of XlsIO is created.[Equivalent to launching MS Excel with no workbooks open].

// The instantiation process consists of two steps.

// Step 1: Instantiate the spreadsheet creation engine.

ExcelEngine excelEngine = new ExcelEngine();

// Step 2: Instantiate the excel application object.

IApplication application = excelEngine.Excel;

//A new workbook is created.[Equivalent to creating a new workbook in MS Excel]
// The number of default worksheets is the application setting in MS Excel.
IWorkbook workbook = application.Workbooks.Add();


If I have misunderstood your requirement, could you please explain me in detail, so that I will provide you a better solution?

Regards,
G.Yavana




Swamidas Dalvi
Replied On August 14, 2008 03:24 PM

Yes you've misunderstood. I have a running instance of MSExcel app open on my desktop and I'm concurrently running my own software which uses ExcelRW to launch a generated excel report in a new instance of MSExcel app. Is there any way to get the report opened in the already open instance like a child form of the MDI app? This will enable me to view it alongside other open Excel documents in the same instance of Excel via Window -> Arrange menu for Tiled, Horizontal, Vertical or Cascade options.


Administrator [Syncfusion]
Replied On August 18, 2008 11:32 AM

I'll appreciate a conclusive answer to this issue. Could someone help with this?


Yavanaarasi G [Syncfusion]
Replied On August 19, 2008 08:18 AM

Hi Swamidas,

By default, the file will be open with the already opened Excel workbook. And currently we do not have options like Arrange menu. We have logged a feature request[#3129] regarding this issue. We will update you once the feature has been implemented.

Please let me know if you have any other concerns.

Regards,
G.Yavana


Swamidas Dalvi
Replied On August 19, 2008 10:53 AM

Are you saying this is true of XlsIO and ExcelRW both? I'm positive that this is not the default behavior that I've observed with ExcelRW so you must be talking about XlsIO. Please confirm if I've understood correctly.


Swamidas Dalvi
Replied On August 19, 2008 10:59 AM

Just wanted to confirm that I'm still talking about the "launching in existing Excel instance" issue. I don't care whether your product supports the "Arrange" option - that is not what I'm looking for as it is already available in Excel which the user can manually apply.


Yavanaarasi G [Syncfusion]
Replied On August 20, 2008 07:10 AM

Hi Swamidas,

Thank you for your update.

Currenlty XlsIO do not provide support for open the excel file with the already opened Excel workbook. By default if the Ms Excel file is already opened and you have open the file in XlsIO, it automatically opens with the already opened workbook.

Please let me know if you have any other concerns.

Regards,
G.Yavana


Swamidas Dalvi
Replied On August 20, 2008 03:22 PM

Would you be able to comment if this behavior was available in ExcelRW? That is what I'm using and would like help with instead of XlsIO.


Yavanaarasi G [Syncfusion]
Replied On August 21, 2008 05:52 AM

Hi Swamidas,

ExcelRW is same as XlsIO, it is the name which is specified previously. As I have mentioned earlier XlsIO or[ExcelRW] do not provide support for getting the report with the already opened Excel workbook.At first you have open an Excel workbook through Ms Excel, before opening the file with ExcelRW. Then you can get the report opened in the already opened Excel workbook.

Please try this and let me know if you have any other concerns.

Regards,
G.Yavana



Swamidas Dalvi
Replied On August 21, 2008 12:24 PM

Yavana,
I'm unable to follow your writing. Let me confirm my understanding of your writing sentence for sentence :

You wrote: ExcelRW is same as XlsIO, it is the name which is specified previously.
I understand: They are both the same. It is just that XlsIO supports .Net 2.0 while ExcelRW supports .Net 1.1 and previous .net versions.

You wrote: As I have mentioned earlier XlsIO or[ExcelRW] do not provide support for getting the report with the already opened Excel workbook.
I understand: What you are trying to say is that it cannot read or write to a file that is already open under Excel. This isn't what I'm trying to do.


You wrote: At first you have open an Excel workbook through Ms Excel, before opening the file with ExcelRW. Then you can get the report opened in the already opened Excel workbook.
I understand: Ok. Let me rework my approach to this and see if it works.


Yavanaarasi G [Syncfusion]
Replied On August 22, 2008 09:08 AM

Hi Swamidas,

Your understanding is correct. But XlsIO have the code library for creating the files and save the file in the disk. We do not have support for open the file directly. XlsIO opens the file through .net only. We can view the file only through viewer. Hence my sentence for second secenerio is we do not open the files directly by side by side.

Regards,
G.Yavana


Frederic Prevost
Replied On September 4, 2008 12:15 PM

Hello,

XlsIO is a tool designed to manipulate XLS file without the need of Excel on the Workstation.

So, if you want to open every XLSIO generated XLS file into the same Excel instance, you can instanciate Excel an store a ref to it into a static Field. After that you have to pilot this Excel instance using OLE-Automation to open file.

Becarefull to memory or Automation problems

Regards,


Geetha M [Syncfusion]
Replied On September 8, 2008 09:45 AM

Hi,

Thank you for the update.

Regards,
Geetha


CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;