close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Changes between Version 1 and Version 2 of OfficialTolArchiveNetworkTolExcel


Ignore:
Timestamp:
Mar 25, 2011, 4:00:58 PM (14 years ago)
Author:
Víctor de Buen Remiro
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • OfficialTolArchiveNetworkTolExcel

    v1 v2  
    55''Note'': In this version just binary files with extension '''.xls''' of '''Excel 97''' are allowed.
    66
     7{{{
     8#!java
     9/* API for Class TolExcel::@WorkBook */
     10Class TolExcel::@WorkBook{
     11
     12/* Methods */
     13/*
     14Non static method defined at TolExcel::@WorkBook
     15Activates the worksheet with specified name
     16*/
     17Real ActivateNamedWS(Text workSheetName, Real readRange, Real headerIndexedByName);
     18
     19/*
     20Non static method defined at TolExcel::@WorkBook
     21Activates the n-th worksheet.
     22If readRange is true then calls to GetSheetMaxRange with argument headerIndexedByName
     23*/
     24Real ActivateWS(Real workSheetNumber, Real readRange, Real headerIndexedByName);
     25
     26/*
     27Non static method defined at TolExcel::@WorkBook
     28Closes the workbook if it is has been open. If you doesn't close it, the workbook will be closed at instance destruction time.
     29*/
     30Real Close(Real void);
     31
     32/*
     33Non static method defined at TolExcel::@WorkBook
     34Call to methodSet ReadMatrix(firstRow, col, _.maxRow-firstRow+1, 1)
     35Method GetSheetMaxRange must be called before.
     36You must set minRow and minCol members before to calling GetSheetMaxRange if there are empty rows or columns before the data cells
     37Returns a Matrix with the numeric values of a rectangle of cells in the current work sheet. Non numeric or empty cells will be interpreted as unknown values.
     38*/
     39Matrix GetFullColumn(Real col, Real firstRow);
     40
     41/*
     42Non static method defined at TolExcel::@WorkBook
     43Call to methodSet ReadMatrix(firstRow, col, _.maxRow-firstRow+1, 1)
     44where col is the index of the column which first row has the specified name.Method GetSheetMaxRange must be called before.
     45You must set minRow and minCol members before to calling GetSheetMaxRange if there are empty rows or columns before the data cells
     46Returns a Matrix with the numeric values of a rectangle of cells in the current work sheet. Non numeric or empty cells will be interpreted as unknown values.
     47*/
     48Matrix GetFullColumnByName(Text name, Real firstRow);
     49
     50/*
     51Non static method defined at TolExcel::@WorkBook
     52Call to methodSet ReadMatrix(minRow=1, minCol=1, _.numRow, _.numCol)
     53Method GetSheetMaxRange must be called before.
     54You must set minRow and minCol members before to calling GetSheetMaxRange if there are empty rows or columns before the data cells
     55Returns a Matrix with the numeric values of a rectangle of cells in the current work sheet. Non numeric or empty cells will be interpreted as unknown values.
     56*/
     57Matrix GetFullMatrix(Real void);
     58
     59/*
     60Non static method defined at TolExcel::@WorkBook
     61Call to methodSet GetRange(minRow=1, minCol=1, _.numRow, _.numCol, columnDefaults)
     62Method GetSheetMaxRange must be called before.
     63You must set minRow and minCol members before to calling GetSheetMaxRange if there are empty rows or columns before the data cells
     64Returns a Set of Sets with the values of a rectangle of cells in the current work sheet. Each cell will have any of allowed types : Text, Real, Date.
     65When argument columnDefaults is not the empty set, then if a cell hasn't the specified type for its column in argument columnDefaults, then the unknown value of the type will be returned.
     66*/
     67Set GetFullRange(Set columnDefaults);
     68
     69/*
     70Non static method defined at TolExcel::@WorkBook
     71Call to methodSet ReadSeries(minRow=1, minCol=1, _.numRow, _.numCol, dating)
     72Method GetSheetMaxRange must be called before.
     73You must set minRow and minCol members before to calling GetSheetMaxRange if there are empty rows or columns before the data cells
     74Returns a Set of series with specified dating. The first columne in the range is considered as the dates supporting the data of the Series. Every column from the column 2 on is considered as the data of one Serie. If dating is W then it will readed from the cell at left top corner. If this cell is empty or it's not a valid TimeSet then the default dating C will be used.
     75*/
     76Set GetFullSeries(TimeSet dating, Text dateFormat);
     77
     78/*
     79Non static method defined at TolExcel::@WorkBook
     80Call to methodSet ReadVMatrix(firstRow, col, _.maxRow-firstRow+1, 1)
     81Method GetSheetMaxRange must be called before.
     82You must set minRow and minCol members before to calling GetSheetMaxRange if there are empty rows or columns before the data cells
     83Returns a VMatrix with the numeric values of a rectangle of cells in the current work sheet. Non numeric or empty cells will be interpreted as unknown values.
     84*/
     85VMatrix GetFullVColumn(Real col, Real firstRow);
     86
     87/*
     88Non static method defined at TolExcel::@WorkBook
     89Call to methodSet ReadVMatrix(firstRow, col, _.maxRow-firstRow+1, 1)
     90where col is the index of the column which first row has the specified name.Method GetSheetMaxRange must be called before.
     91You must set minRow and minCol members before to calling GetSheetMaxRange if there are empty rows or columns before the data cells
     92Returns a VMatrix with the numeric values of a rectangle of cells in the current work sheet. Non numeric or empty cells will be interpreted as unknown values.
     93*/
     94VMatrix GetFullVColumnByName(Text name, Real firstRow);
     95
     96/*
     97Non static method defined at TolExcel::@WorkBook
     98Call to methodSet ReadVMatrix(minRow=1, minCol=1, _.numRow, _.numCol)
     99Method GetSheetMaxRange must be called before.
     100You must set minRow and minCol members before to calling GetSheetMaxRange if there are empty rows or columns before the data cells
     101Returns a VMatrix with the numeric values of a rectangle of cells in the current work sheet. Non numeric or empty cells will be interpreted as unknown values.
     102*/
     103Matrix GetFullVMatrix(Real void);
     104
     105/*
     106Non static method defined at TolExcel::@WorkBook
     107Scans the current work sheet in order to stablish a rectangle of interesting cells, starting from cell [minRow,minCol], wich default value is [1,1]. Reads along first column until an empty cell is found to stablish maxCol. Then, reads along first row until an empty cell is found to stablish maxRow.
     108If argument headerIndexedByName is true stores the cells of first row in member _.headers and indexes it.
     109Note that cells in first row cannot be repeated and must be of type Text.
     110*/
     111Real GetSheetMaxRange(Real headerIndexedByName);
     112
     113/*
     114Non static method defined at TolExcel::@WorkBook
     115Returns true if the specified cell is empty
     116*/
     117Real IsEmptyCell(Real row, Real col);
     118
     119/*
     120Non static method defined at TolExcel::@WorkBook
     121Reads from current active work sheet the content of specified cell returning one of these types: Text, Date, Real
     122*/
     123Anything ReadCell(Real row, Real col);
     124
     125/*
     126Non static method defined at TolExcel::@WorkBook
     127Reads from current active work sheet the content of specified cell returning a Date
     128*/
     129Date ReadDate(Real row, Real col);
     130
     131/*
     132Non static method defined at TolExcel::@WorkBook
     133Returns a Matrix with the numeric values of a rectangle of cells in the current work sheet. Non numeric or empty cells will be interpreted as unknown values.
     134*/
     135Matrix ReadMatrix(Real row_ini, Real col_ini, Real row_num, Real col_num);
     136
     137/*
     138Non static method defined at TolExcel::@WorkBook
     139Returns a Set of Sets with the values of a rectangle of cells in the current work sheet. Each cell will have any of allowed types : Text, Real, Date.
     140When argument columnDefaults is not the empty set, then if a cell hasn't the specified type for its column in argument columnDefaults, then the unknown value of the type will be returned.
     141*/
     142Set ReadRange(Real row_ini_, Real col_ini_, Real row_num, Real col_num, Set columnDefaults);
     143
     144/*
     145Non static method defined at TolExcel::@WorkBook
     146Reads from current active work sheet the content of specified cell returning a Real
     147*/
     148Real ReadReal(Real row, Real col);
     149
     150/*
     151Non static method defined at TolExcel::@WorkBook
     152Returns a Set of series with specified dating. The first columne in the range is considered as the dates supporting the data of the Series. Every column from the column 2 on is considered as the data of one Serie. If dating is W then it will readed from the cell at left top corner. If this cell is empty or it's not a valid TimeSet then the default dating C will be used.
     153*/
     154Set ReadSeries(Real row_ini, Real col_ini, Real row_num, Real col_num, TimeSet dating, Text dateFormat);
     155
     156/*
     157Non static method defined at TolExcel::@WorkBook
     158Reads from current active work sheet the content of specified cell returning a Text
     159*/
     160Text ReadText(Real row, Real col);
     161
     162/*
     163Non static method defined at TolExcel::@WorkBook
     164Returns a VMatrix with the numeric values of a rectangle of cells in the current work sheet. Non numeric or empty cells will be interpreted as unknown values.
     165*/
     166VMatrix ReadVMatrix(Real row_ini, Real col_ini, Real row_num, Real col_num);
     167
     168/*
     169Non static method defined at TolExcel::@WorkBook
     170Saves changes in workbook
     171*/
     172Real Save(Real void);
     173
     174/*
     175Non static method defined at TolExcel::@WorkBook
     176Saves changes in workbook in the specified path
     177*/
     178Real SaveAs(Text path);
     179
     180/*
     181Non static method defined at TolExcel::@WorkBook
     182Writes into the specified cell of current active work sheet the specified value with on of these types: Text, Date, Real
     183*/
     184Anything WriteCell(Real row, Real col, Anything value);
     185
     186/*
     187Non static method defined at TolExcel::@WorkBook
     188Writes a Matrix in the range of cells starting with the specified cell of current active work sheet.
     189Returns the number of modified cells.
     190*/
     191Real WriteMatrix(Real row, Real col, Matrix values);
     192
     193/*
     194Non static method defined at TolExcel::@WorkBook
     195Writes a range of cells starting with the specified cell of current active work sheet. Set cellValues must be a set of sets which elements are of one of these types: Text, Real, Date.
     196Returns the number of modified cells.
     197*/
     198Real WriteRange(Real row0, Real col0, Set cellValues);
     199
     200/*
     201Non static method defined at TolExcel::@WorkBook
     202Writes a range of cells starting with the specified cell of current active work sheet. Set series must be a set of series with the same dating.
     203Returns the number of modified cells.
     204*/
     205Real WriteSeries(Real row, Real col, Set series, Text dateFormat);
     206
     207/*
     208Non static method defined at TolExcel::@WorkBook
     209Writes a VMatrix in the range of cells starting with the specified cell of current active work sheet.
     210Returns the number of modified cells.
     211*/
     212Real WriteVMatrix(Real row, Real col, Matrix values);
     213
     214/*
     215Non static method defined at TolExcel::@WorkBook
     216Returns de internal identifier of excel workbook handler.
     217*/
     218Real get_id(Real void);
     219
     220/*
     221Static method defined at TolExcel::@WorkBook
     222Creates an empty workbook.
     223*/
     224Static @WorkBook New(Text path);
     225
     226/*
     227Static method defined at TolExcel::@WorkBook
     228Opens an existent workbook.
     229*/
     230Static @WorkBook Open(Text path)/* Members */;
     231
     232/*
     233Non static member defined at TolExcel::@WorkBook
     234Column headers. Used in method GetSheetMaxRange when argument headerIndexedByName is true.
     235*/
     236Set _.header = Copy(Empty);
     237
     238/*
     239Non static member defined at TolExcel::@WorkBook
     240If true, the first row was interpreted as column headers and will be stored in _.header. Used in method GetSheetMaxRange.
     241*/
     242Real _.headerIndexedByName = False;
     243
     244/*
     245Non static member defined at TolExcel::@WorkBook
     246Last columns that was readed in method GetSheetMaxRange.
     247*/
     248Real _.maxCol = ?;
     249
     250/*
     251Non static member defined at TolExcel::@WorkBook
     252Last row that was readed in method GetSheetMaxRange.
     253*/
     254Real _.maxRow = ?;
     255
     256/*
     257Non static member defined at TolExcel::@WorkBook
     258Number of columns that were readed in method GetSheetMaxRange.
     259*/
     260Real _.numCol = ?;
     261
     262/*
     263Non static member defined at TolExcel::@WorkBook
     264Number of rows that were readed in method GetSheetMaxRange.
     265*/
     266Real _.numRow = ?;
     267
     268/*
     269Non static member defined at TolExcel::@WorkBook
     270First column to be readed in method GetSheetMaxRange. Must be set by user if it's not the fiersdt one before to calling GetSheetMaxRange
     271*/
     272Real minCol = 1;
     273
     274/*
     275Non static member defined at TolExcel::@WorkBook
     276First row to be readed in method GetSheetMaxRange. Must be set by user if it's not the fiersdt one before to calling GetSheetMaxRange
     277*/
     278Real minRow = 1;
     279
     280/*
     281Non static member defined at TolExcel::@WorkBook
     282
     283*/
     284Real verbose = True;
     285
     286/*
     287Non static member defined at TolExcel::@WorkBook
     288The path of the workbook archive used in Open or New methods
     289*/
     290Text _.path;
     291
     292/*
     293Static member defined at TolExcel::@WorkBook
     294Default date format.
     295*/
     296Static Text defaultDateFormat = "%Y-%m-%d";
     297
     298/*
     299Static member defined at TolExcel::@WorkBook
     300Maximum number of columns that a work sheet can store. Used in method GetSheetMaxRange.
     301*/
     302Static Real maxAllowedCol = 256;
     303
     304/*
     305Static member defined at TolExcel::@WorkBook
     306Maximum number of rows that a work sheet can store. Used in method GetSheetMaxRange.
     307*/
     308Static Real maxAllowedRow = 256^2;
     309
     310/*
     311Static member defined at TolExcel::@WorkBook
     312Controls warnings verbosity.
     313*/
     314Static Real showMassiveWarning = False
     315};
     316}}}