KnowledgeInterfaces Interface CATICkeSheet
Usage: an implementation of this interface is supplied and you must use it as is. You should not reimplement it.
interface CATICkeSheet
This interface is an encapsulation of an array of arrays (a sheet) of strings contained in a file.
This file can be an excel sheet, or a tabulated text file.The format of the text file
has to be :
string1,1 | TAB | string1,2 | ... |
(n-2 lines) |
stringn,1 | TAB | stringn,2 | ... |
Empty strings are allowed, but not in the first row because the number of columns is computed using the first row.
For design table use, the file is parsed until its end or until the first empty row is found.
If you use sheets of format Excel , be careful not to leave Excel process resident in memory (take care of SetCell arguments).
A sheet feature has a link to a file. This link has a direction, and this direction is impacting the way links between files (CATIA model and external file)
are shown in Impact Graph in LCA.
- See also:
- ,
Method Index
- o
Cell(int,int)
- Gets the cell r,c.
- o
ChangeSourceFile(CATUnicodeString&)
- This method is used to change the source file.
- o
Column(int)
- Gets the column c of the sheet.
- o
Columns()
- Gets the number of columns in the sheet.
- o
CopyMode()
- Returns the value of the CopyMode_ attribute.
- o
CreateSourceFile(CATUnicodeString&,int)
- Creates a file for future sheet.
- o
ExportContentToFile(CATUnicodeString&,int)
- Exports all the sheet content to a Text or an Excel file.
- o
ExportContentToRepRef(CATIPsiRepresentationReference_var&,int)
- Exports all the sheet content to a representation reference (containing text or excel file).
- o
GetCallbackCommand()
- Gets the associated command that sends the Ole doc.
- o
GetFileDateChangedNotification()
- Do not use.
- o
GetOrientation()
- Returns the orientation of the sheet.
- o
GetSourceFilePath()
- Returns the path and name of the file from which data are imported.
- o
GetSourceFormat()
- This method allows to know the format of the linked file.
- o
GetSourceLinkDirection()
- Returns the quality of source file link attribute (sp_in or sp_out).
- o
GetSourceRepRef(CATIPsiRepresentationReference_var&)
- Returns the representation reference.
- o
GetSourceStatus()
- This method is used to know the status of the source file.
- o
IsSourceModified()
- Indicates if the representation reference has been modified.
- o
LaunchEditor()
- Launches the sheet editor.
- o
Row(int)
- Gets the row r of the sheet.
- o
Rows()
- Gets the number of rows in the sheet.
- o
SetCell(int,int,CATUnicodeString&,CATCke::Boolean,CATCke::Boolean)
- Sets the content of the cell (r,c) in the sheet and saves the sheet if lastCell = True.
- o
SetCopyMode(CATCke::Boolean)
- Indicates if source file data has to be copied into the CATIA model.
- o
SetOrientation(int)
- Sets the orientation of the sheet.
- o
SetSourceFilePath(CATUnicodeString&)
- Sets the path of the file containing the data.
- o
SetSourceLinkDirection(int)
- Changes the quality of source file link attribute (sp_in or sp_out).
- o
SetSourceRepRef(CATIPsiRepresentationReference_var&)
- Sets the representation reference of the sheet.
- o
SynchronizeLinkToRep()
- Synchronizes if needed the link between the sheet and the PLM Representation encapsulating the source file.
- o
UpdateLocalCopy(int,int)
- Performs analysis of the sheet.
- o
UpdateLocalCopyFromSpec()
- Does the same work as UpdateLocalCopy.
- o
WhichColumn(int,CATUnicodeString&)
- Gets the index of the column where the sheet takes the value of columnContent in the row r.
- o
WhichRow(int,CATUnicodeString&)
- Gets the index of the row where the sheet takes the value of rowContent in the column c.
Enumerated Type Index
- o
SourceFormat
-
- o
SourceStatus
-
Methods
o Cell
public virtual Cell( | const | r, |
| const | c) |
-
Gets the cell r,c.
- Returns:
- the content of the cell r,c. An empty cell if coordinates are wrong
- Parameters:
-
- r
- the row of the wanted cell (1-based)
- c
- the column of the wanted cell (1-based)
o ChangeSourceFile
public virtual ChangeSourceFile( | const | path) |
-
This method is used to change the source file. The type of
the file must be the same as the old one...(excel <-> excel, text file <-> text file).
This method only changes the source file : it doesn't update the content of the sheet (no call to UpdateLocalCopy)
- Returns:
- False if the method fails
- Parameters:
-
- path
- the path of the new source file
o Column
public virtual Column( | const | c) |
-
Gets the column c of the sheet.
- Returns:
- const CATListOfCATUnicodeString* : this list must not be destroyed and doesn't change until this method is called again. If c > Columns() returns NULL
- Parameters:
-
- c
- the wanted column. 1-based Index
o Columns
-
Gets the number of columns in the sheet.
- Returns:
- the number of columns
o CopyMode
public virtual CopyMode( | ) |
-
Returns the value of the CopyMode_ attribute.
o CreateSourceFile
public virtual CreateSourceFile( | const | path, |
| const | iCreateLink | = 1) |
-
Creates a file for future sheet. If the path contains the .xls extension,
an excel file is created. Else, a text file is created
- Returns:
- CATCke::False if the creation of the file fails
- Parameters:
-
- path
- The path of the file to create
- iCreateLink
- A link to the file is created on the feature
o ExportContentToFile
public virtual ExportContentToFile( | const | iFilePath, |
| | iReplaceFileIfExist) |
-
Exports all the sheet content to a Text or an Excel file.
- Parameters:
-
- iFilePath
- The path of the file that will be created. If it contains :
- ".xls", an excel file will be created
else, a text file will be created.
The link is not kept with the file (if you go on modifying the model sheet
after exporting its content to a file, the file content will not be up to
date with the model sheet content). The file is just a visible image of
the sheet content at a given instant.
Notice that this method will fail if you give the path of an existing file
without setting the 2d argument to 1 or if the existing file access is not
Read/Write.
- iReplaceFileIfExist
- If you give a path that corresponds to an existing file, you have to set it to 1
to force the file replacement (else this method will failed).By default, this
argument is set to 0 in order to keep the existing file.
- Returns:
- E_FAIL if the file creation or the file filling failed, and S_OK else.
o ExportContentToRepRef
public virtual ExportContentToRepRef( | | iospRepRef, |
| | iReplaceRepresentationReferenceIfExist | =0) |
-
Exports all the sheet content to a representation reference (containing text or excel file).
- Parameters:
-
- iospRepRef
- The representation reference won't be created. The link is not kept with the representation reference (if you go on modifying the model sheet
after exporting its content to representation reference, the representation reference content will not be up to
date with the model sheet content). The representation reference is just a visible image of
the sheet content at a given instant.
Notice that this method will fail if you give an existing representation reference
without setting the second argument to 1.
- iReplaceRepresentationReferenceIfExist
- If you give a representation reference that corresponds to an existing representation reference, you have to set it to 1
to force the representation reference replacement (else this method will failed).By default, this
argument is set to 0 in order to keep the existing representation reference.
- Returns:
- E_FAIL if the representation reference filling failed, and S_OK else.
o GetCallbackCommand
public virtual GetCallbackCommand( | ) |
-
Gets the associated command that sends the Ole doc. Close and modify notification
If a client wants to receive this notification, he has to write :
AddCallback(sheet->GetCallbackCommand(), sheet->GetOleModifyAndCloseNotification(), (CATSubscriberMethod) &CATClientClass::OnSheetModification))
- Returns:
- the command
o GetFileDateChangedNotification
public virtual GetFileDateChangedNotification( | ) |
-
Do not use.
- Returns:
- the event
o GetOrientation
public virtual GetOrientation( | ) |
-
Returns the orientation of the sheet.
- Returns:
- 1 for vertical columns and 0 for horizontal ones.
o GetSourceFilePath
public virtual GetSourceFilePath( | ) |
-
Returns the path and name of the file from which data are imported.
o GetSourceFormat
public virtual GetSourceFormat( | ) |
-
This method allows to know the format of the linked file.
- Returns:
- CATICkeSheet::Text if text file, CATICkeSheet::Excel if Excel file If no file is associated, or if the link is lost,
returns CATICkeSheet::NoSource
o GetSourceLinkDirection
public virtual GetSourceLinkDirection( | ) |
-
Returns the quality of source file link attribute (sp_in or sp_out).
- Returns:
- 1 for sp_In, 0 for sp_Out (CATISpecDeclarations not available here)
o GetSourceRepRef
public virtual GetSourceRepRef( | | oRepresentation) |
-
Returns the representation reference.
- Parameters:
-
- oRepresentation
- The representation reference
- Returns:
- E_FAIL if the method fails or S_OK if the method succeeds
o GetSourceStatus
public virtual GetSourceStatus( | ) |
-
This method is used to know the status of the source file.
- Returns:
- CATICkeSheet::NotFound if the file isn't found, CATICkeSheet::ReadOnly if the file is read-only, CATICkeSheet::ReadWriteOk if the file can be written to,
CATICkeSheet::Empty if the file path is empty
o IsSourceModified
public virtual IsSourceModified( | ) |
-
Indicates if the representation reference has been modified.
- Parameters:
-
- oRepRefModified
- 1 if date stored in sheet feature is different from file one, 0 else.
- Returns:
- E_FAIL if the method fails or S_OK if the method succeeds
o LaunchEditor
public virtual LaunchEditor( | ) |
-
Launches the sheet editor.
Warning, the behaviour of this method is different for text files or Excel files :
its call is blocking for text files and not for other ones.
For Excel files, to be warned after Excel closure in case of a sheet modification,
you have to put a callback on CATICkeOleSheet::GetOleModifyAndCloseNotification event.
- Returns:
- S_OK if method succeeds, E_FAIL if method fails : for example, calling it on UNIX for an Excel based design table, or calling it on NT with Excel not installed
o Row
public virtual Row( | const | r) |
-
Gets the row r of the sheet.
- Returns:
- const CATListOfCATUnicodeString* : this list mustn't be destroyed and doesn't change until this method is called again. If r > Rows() returns NULL
- Parameters:
-
- r
- the wanted row. 1-based Index
o Rows
-
Gets the number of rows in the sheet. It includes the columns titles row.
- Returns:
- the number of rows
o SetCell
public virtual SetCell( | const | r, |
| const | c, |
| const | s, |
| | firstCell | =1, |
| | lastCell | =1) |
-
Sets the content of the cell (r,c) in the sheet and saves the sheet if lastCell = True.
WARNING : for text files, this method has strong performance problems. Use CATICkeSheet::AddRow instead of SetCell to fix them
- Parameters:
-
- r
- (1-based index) row parameter
- c
- (1-based index) column parameter
- s
- cell content
- firstCell
- this flag has to be set to True if the SetCell function is called for the first time since UpdateLocalCopy method was called
- lastCell
- this flag has to be set to True if the SetCell function is called for the last time until UpdateLocalCopy method is called
- Returns:
- CATCke::True if the function succeded, CATCke::False else
o SetCopyMode
public virtual SetCopyMode( | | mode) |
-
Indicates if source file data has to be copied into the CATIA model.
- Parameters:
-
- mode
- : if True, performs a persistent copy of the content of the sheet
o SetOrientation
public virtual SetOrientation( | const | vertical) |
-
Sets the orientation of the sheet.
- Parameters:
-
- vertical
- equal to 1 for vertical columns and 0 for horizontal ones.
o SetSourceFilePath
public virtual SetSourceFilePath( | const | path) |
-
Sets the path of the file containing the data. The format of the file is tabulated.
- Parameters:
-
- path
- The path to be set
o SetSourceLinkDirection
public virtual SetSourceLinkDirection( | | iIn) |
-
Changes the quality of source file link attribute (sp_in or sp_out).
- Parameters:
-
- iIn
- [in] 1 for sp_In, 0 for sp_Out (CATISpecDeclarations not available here)
o SetSourceRepRef
public virtual SetSourceRepRef( | const | iRepresentation) |
-
Sets the representation reference of the sheet.
The format of the file is tabulated.
- Parameters:
-
- iRepresentation
- The new representation reference
- Returns:
- E_FAIL if the method fails or S_OK if the method succeeds or
E_INVALIDARG if representation reference isn't correct
o SynchronizeLinkToRep
public virtual SynchronizeLinkToRep( | ) |
-
Synchronizes if needed the link between the sheet and the PLM Representation encapsulating the source file.
- Returns:
- TRUE is the the link had to be synchronized, FALSE otherwise
o UpdateLocalCopy
public virtual UpdateLocalCopy( | const | forceWidth | = 0, |
| const | forceHeight | = 0) |
-
Performs analysis of the sheet.
(parses the content of the sheet, updates the number of columns and rows)
- Parameters:
-
- forceWidth
- this parameter mustn't be used in most cases : it forces the width (nb of columns)
looked for (used in CATCkeImportServices to ensure that the columns of formulas and comments will be read).
If forceWidth != 0, the nb of column will be >= forceWidth
- forceHeight
- the counterpart of forceWidth for the height of the sheet
- Returns:
- CATCke::False if the parsing fails (empty sheet, no sheet, ...)
o UpdateLocalCopyFromSpec
public virtual UpdateLocalCopyFromSpec( | ) |
-
Does the same work as UpdateLocalCopy.
But with data taken from the model (if CopyMode_ is equal to True).
- Returns:
- False if no data was put in the model (CopyMode_ = False)
o WhichColumn
public virtual WhichColumn( | const | r, |
| const | columnContent) |
-
Gets the index of the column where the sheet takes the value of columnContent in the row r.
- Returns:
- the 1-based index of the searched column, 0 if not found
- Parameters:
-
- r
- the row where the search is done
- columnContent
- the string searched
o WhichRow
public virtual WhichRow( | const | c, |
| const | rowContent) |
-
Gets the index of the row where the sheet takes the value of rowContent in the column c.
- Returns:
- the 1-based index of the searched row, 0 if not found
- Parameters:
-
- c
- the column where the search is done
- rowContent
- the string searched
Enumerated Types
o SourceFormat
-
enum SourceFormat {
Text,
Excel,
NoSource
}
o SourceStatus
-
enum SourceStatus {
ReadOnly,
NotFound,
ReadWriteOk,
Empty,
NotReadable
}
This object is included in the file: CATICkeSheet.h
If needed, your Imakefile.mk should include the module: KnowledgeItf
Copyright © 1999-2015, Dassault Systèmes. All rights reserved.