Is it possible to open and close excel sheets using DXL Scripts. If it is possible, can you please send me the script across. |
Re: Opening and closing of excel files lib\dxl\standard\export\office\excel.dxl This is the DOORS standard Excel export (File / Export / Microsoft Office / Excel). |
Re: Opening and closing of excel files If I remember correctly, it was David Pechacek who initially put all the OLE stuff in a dedicated include file which you can use for your own tailored export to Excel (actually it is put in the two attached files, ole.inc and excel.inc). You can find his original files at Kevin Murphy's site: http://www.baselinesinc.com/?page_id=11. The attached files are somewhat modified by myself in order to add additional functions (adding a sheet to a workbook, setting borders for cell ranges, setting the auto-filter, etc.) When you use the files, make sure to modify the line #include <../include/ole.inc> in excel.inc such that it matches the place where you put the ole.inc. Once you have it put in place, you can have a look at e.g. void showColors() in excel.inc to get an idea on how to actually export to Excel. The routine opens an Excel sheet and displays the available colours. For understanding how it works, it is important to know that the whole set of routines works with global variables, e.g. a call to 'openExcel()' sets the global variable 'objExcel', which you can then use in 'makeVisible(objExcel)'. Regards, Peter Attachments attachment_14347286_excel_ole.zip |
Re: Opening and closing of excel files
string filename = "somefile.xls"
OleAutoObj ObjExcel = oleGetAutoObject("Excel.Application") // Connect With Excel
if(null ObjExcel) // Excel not opened
ObjExcel = oleCreateAutoObject("Excel.Application") // Open Excel
OleAutoObj objWB = null
OleAutoObj objWBs = null
OleAutoArgs autoArgs = create
olePut(objExcel,"Visible",true) // Make excel visible
oleGet(objExcel,"Workbooks", objWBS)
put (autoArgs,filename"")
oleMethod(objWBS,"Open",autoArgs,objWB)
if(null objWB)
{
clear autoArgs
put (autoArgs,1) // Create new workbook (different numbers are assigned to create different items)
oleMethod(objWBS,"Add",autoArgs,objWB)
clear autoArgs
put(autoArgs,filename"")
oleMethod(objWB,"SaveAs",autoArgs)
}
delete autoArgs objWB = null objWBS = null objExcel = null
|
Re: Opening and closing of excel files tommy3824 - Fri Nov 13 13:47:11 EST 2009
string filename = "somefile.xls"
OleAutoObj ObjExcel = oleGetAutoObject("Excel.Application") // Connect With Excel
if(null ObjExcel) // Excel not opened
ObjExcel = oleCreateAutoObject("Excel.Application") // Open Excel
OleAutoObj objWB = null
OleAutoObj objWBs = null
OleAutoArgs autoArgs = create
olePut(objExcel,"Visible",true) // Make excel visible
oleGet(objExcel,"Workbooks", objWBS)
put (autoArgs,filename"")
oleMethod(objWBS,"Open",autoArgs,objWB)
if(null objWB)
{
clear autoArgs
put (autoArgs,1) // Create new workbook (different numbers are assigned to create different items)
oleMethod(objWBS,"Add",autoArgs,objWB)
clear autoArgs
put(autoArgs,filename"")
oleMethod(objWB,"SaveAs",autoArgs)
}
delete autoArgs objWB = null objWBS = null objExcel = null
NEVER open Excel like this:
OleAutoObj ObjExcel = oleGetAutoObject("Excel.Application") // Connect With Excel
if(null ObjExcel) // Excel not opened
ObjExcel = oleCreateAutoObject("Excel.Application") // Open Excel
|
Re: Opening and closing of excel files I understand the concept, but I still wind up with multiple excel processes running after close. I'm using this: oleCloseAutoObject wbs oleCloseAutoObject wb oleCloseAutoObject ws oleCloseAutoObject ex wbs = null wb = null ws = null ex = null
|
Re: Opening and closing of excel files moheganburnerIII - Fri Oct 21 16:06:44 EDT 2011 I understand the concept, but I still wind up with multiple excel processes running after close. I'm using this: oleCloseAutoObject wbs oleCloseAutoObject wb oleCloseAutoObject ws oleCloseAutoObject ex wbs = null wb = null ws = null ex = null
Mathias Mamsch, IT-QBase GmbH, Consultant for Requirement Engineering and D00RS |