Welcome to Telelogic Product Support
  Home Downloads Knowledgebase Case Tracking Licensing Help Telelogic Passport
Telelogic DOORS (steve huntington)
Decrease font size
Increase font size
Topic Title: Modifying Enhanced Excel Report
Topic Summary:
Created On: 24-Sep-2008 00:38
Status: Post and Reply
Linear : Threading : Single : Branch
Search Topic Search Topic
Topic Tools Topic Tools
Quick Reply Quick Reply
Subscribe to this topic Subscribe to this topic
E-mail this topic to someone. E-mail this topic
Bookmark this topic Bookmark this topic
View similar topics View similar topics
View topic in raw text format. Print this topic.
 24-Sep-2008 00:38
User is offline View Users Profile Print this message


anant mitra

Posts: 50
Joined: 27-Jul-2007

Hi,

I've commented out the UI portion from the script (from Galactic Solutions) and run the script so that by default, the OLE objects are exported to Excel. Everything's dandy till now. I've added a function called 'saveFile()' to automatically save the excel file to my desired location. However, it's not saving the file; the 'Do you wish to save the excel file?' dialog appears.

Could anyone let me know where the boo-boo is?

Thanks.


Report this to a Moderator Report this to a Moderator
 24-Sep-2008 01:04
User is offline View Users Profile Print this message


ron lewis

Posts: 650
Joined: 20-Sep-2004

Look on the web -- there is a parameter that has to be set to either true or false to save while passing the dialog box.

However, my memory can not remember the parameter off the top of my head.
Report this to a Moderator Report this to a Moderator
 24-Sep-2008 12:57
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Here is my function to save a new file after it has been created.

The file open is just a bool I set to true to know that a file was indeed created. Just look at the important part.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 24-Sep-2008 18:11
User is offline View Users Profile Print this message


anant mitra

Posts: 50
Joined: 27-Jul-2007

I tried my saveFile() function and also the one you showed. This is the error message I get:

OLE Method Failed:
Problem with OLE Argument names

How do I address that?


This is the piece of code that is under consideration:
clear objArgBlock
put(objArgBlock, "FileName", exportDir expName)
string tempStr = oleMethod(docHandle, "SaveAs", objArgBlock)
Report this to a Moderator Report this to a Moderator
 24-Sep-2008 18:13
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Looking at just those 3 lines of code I can't tell you anything. Is your docHandle a workbook? Is your exportDir and expName formatted correctly?

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 24-Sep-2008 18:29
User is offline View Users Profile Print this message


anant mitra

Posts: 50
Joined: 27-Jul-2007

Here's a detailed look at the function:

void saveFile (string exportDir, string expName, OleAutoObj docHandle)
{
expName = expName ".csv"
clear objArgBlock
put(objArgBlock, "FileName", exportDir expName)
string tempStr = oleMethod(docHandle, "SaveAs", objArgBlock)
if ( tempStr != null)
errorBox("SaveFile Failed!")


// close the excel file and then disconnect from excel
clear objArgBlock
put(objArgBlock, "SaveChanges", false)
oleMethod(docHandle, "Close", objArgBlock)
} // end saveFile

I'm calling the function as:
saveFile (OUTPUTLOCATION, name module "", objDoc)

where OUTPUTLOCATION is decalred as
const string OUTPUTLOCATION = "C:/Documents and Settings/My Documents/"
and objDoc is declared as
OleAutoObj objDoc = oleCreateAutoObject("Excel.Application")
and module is declared are
Module module = current

Thank You.
Report this to a Moderator Report this to a Moderator
 24-Sep-2008 21:21
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

Originally posted by: anant mitraOleAutoObj objDoc = oleCreateAutoObject("Excel.Application")


Thats your problem. You're trying to save Excel, not the Workbook.

The OleAutoObj you call the SaveAs function with needs to be a handle to a Workbook.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 24-Sep-2008 21:34
User is offline View Users Profile Print this message


anant mitra

Posts: 50
Joined: 27-Jul-2007

The workbook(s) is used in several functions in the script, as a function parameter. I'm confused by the number of times it is passed to different functions (line 930 onward, in the script).Will making it a global variable will resolve the issue?
Report this to a Moderator Report this to a Moderator
 25-Sep-2008 12:47
User is offline View Users Profile Print this message


David Pechacek

Posts: 674
Joined: 5-Dec-2006

There is a Workbooks property and a Workbook. You need the Workbook. Just instead of passing the docHandle variable to saveFile, pass your Workbook handle.

-------------------------
David Pechacek
AAI Services Textron
dpechacek@sc-aaicorp.com
David.Pechacek@gmail.com
Report this to a Moderator Report this to a Moderator
 25-Sep-2008 18:17
User is offline View Users Profile Print this message


anant mitra

Posts: 50
Joined: 27-Jul-2007

It is able to generate an excel sheet just as needed. With the excel window frame intact, when I close the sheet and double click the file in windows explorer, it bring up the document it generated. However, when I kill the excel window frame and then double click on the file, on the excel window frame appears, not the excel sheet. And the frame is all garbled at the top; meaning, it doesn't have it usual menu bar or anything.

Edited: 25-Sep-2008 at 21:22 by anant mitra
Report this to a Moderator Report this to a Moderator
Statistics
20925 users are registered to the Telelogic DOORS forum.
There are currently 1 users logged in.
The most users ever online was 15 on 15-Jan-2009 at 16:36.
There are currently 0 guests browsing this forum, which makes a total of 1 users using this forum.
You have posted 0 messages to this forum. 0 overall.

FuseTalk Standard Edition v3.2 - © 1999-2009 FuseTalk Inc. All rights reserved.