Toggle menu
876
3.8K
30.2K
279.1K
Catglobe Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

ExcelSheet class: Difference between revisions

From Catglobe Wiki
Tungocman (talk | contribs)
No edit summary
No edit summary
Line 1: Line 1:
{{CGscriptClass_Template
{{CGscriptClass_Template
|Name=<nowiki>ExcelSheet</nowiki>
|Name=ExcelSheet
|Description=<nowiki>An excel sheet</nowiki>
|Description=An excel sheet
|Constructors=
|Constructors=
{{CGscriptConstructors_Template|Parameters=
{{CGscriptConstructors_Template|Parameters=
{{CGscriptParameters_Template|Type=string|Name=<nowiki>filename</nowiki>|Description=<nowiki>Name of the file</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=<nowiki>isTemp</nowiki>|Description=<nowiki>Is the file temporary</nowiki>}}
{{CGscriptParameters_Template|Type=string|Name=filename|Description=Name of the file|Comma=,}}{{CGscriptParameters_Template|Type=bool|Name=isTemp|Description=Is the file temporary}}
|Description=<nowiki>Load a file from FileNamespace</nowiki>}}
|Description=Load a file from FileNamespace}}
|Methods=
|Methods=
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>ToArray</nowiki>|Parameters=
{{CGscriptMethods_Template|ReturnType=array|Name=ToArray|Parameters=
{{CGscriptParameters_Template|Type=string|Name=<nowiki>sheetName</nowiki>|Description=<nowiki>The sheet to convert</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=number|Name=<nowiki>fromrow</nowiki>|Description=<nowiki>Skip number of rows</nowiki>}}
{{CGscriptParameters_Template|Type=string|Name=sheetName|Description=The sheet to convert|Comma=,}}{{CGscriptParameters_Template|Type=number|Name=fromrow|Description=Skip number of rows}}
|Description=<nowiki>Convert the sheet to an array of equal sized arrays</nowiki>}}
|Description=Convert the sheet to an array of equal sized arrays}}
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>ToHeaders</nowiki>|Parameters=
{{CGscriptMethods_Template|ReturnType=array|Name=ToHeaders|Parameters=
{{CGscriptParameters_Template|Type=string|Name=<nowiki>sheetName</nowiki>|Description=<nowiki>The sheet to convert</nowiki>}}
{{CGscriptParameters_Template|Type=string|Name=sheetName|Description=The sheet to convert}}
|Description=<nowiki>Convert the first row to array of strings</nowiki>}}
|Description=Convert the first row to array of strings}}
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}}
{{CGscriptMethods_Template|ReturnType=string|Name=ToString|Description=The string representation of the object.}}
|Properties=
|Properties=
{{CGscriptProperties_Template|ReturnType=string|Name=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
{{CGscriptProperties_Template|ReturnType=string|Name=ObjectTypeName|HasGetter=1|Description=The name of the type of object.}}
{{CGscriptProperties_Template|ReturnType=array|Name=<nowiki>SheetNames</nowiki>|HasGetter=1|Description=<nowiki>Get list of sheets in the excel file</nowiki>}}
{{CGscriptProperties_Template|ReturnType=array|Name=SheetNames|HasGetter=1|Description=Get list of sheets in the excel file}}
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=TypeInformation|HasGetter=1|Description=Get information about this class.}}
}}
}}


=== Examples ===
=== Examples ===
<source lang="javascript">
<source lang="javascript">
string filename = "Upload2.xlsx";
string filename = "Upload2.xlsx";
bool isTemp = true;
bool isTemp = true;
ExcelSheet es = new ExcelSheet(filename, isTemp);
ExcelSheet es = new ExcelSheet(filename, isTemp);
string sheet1 = es.SheetNames.First();
string sheet1 = es.SheetNames.First(function(string a) { true; });
array headers = es.ToHeaders();
array headers = es.ToHeaders();
array data = es.ToArray(sheet1, 1);
array data = es.ToArray(sheet1, 1);
Line 31: Line 32:
Catglobe.File.Delete(filename, isTemp);
Catglobe.File.Delete(filename, isTemp);
</source>
</source>
[[Category:Classes]]

Revision as of 04:48, 7 April 2015

ExcelSheet



An excel sheet

Constructors

  • (string filename "Name of the file", bool isTemp "Is the file temporary") - Load a file from FileNamespace

Methods

  • array ToArray(string sheetName "The sheet to convert", number fromrow "Skip number of rows") - Convert the sheet to an array of equal sized arrays
  • array ToHeaders(string sheetName "The sheet to convert") - Convert the first row to array of strings
  • string ToString() - The string representation of the object.

Properties

  • string ObjectTypeName { get; } - The name of the type of object.
  • array SheetNames { get; } - Get list of sheets in the excel file
  • TypeInformation TypeInformation { get; } - Get information about this class.


Examples

string filename = "Upload2.xlsx";
bool isTemp = true;
ExcelSheet es = new ExcelSheet(filename, isTemp);
string sheet1 = es.SheetNames.First(function(string a) { true; });
array headers = es.ToHeaders();
array data = es.ToArray(sheet1, 1);
ImportManager im = new ImportManager(headers, data, ...);
Catglobe.File.Delete(filename, isTemp);