Difference between revisions of "ExcelSheet class"

From Catglobe Wiki
Jump to: navigation, search
 
(3 intermediate revisions by 2 users not shown)
Line 2: Line 2:
 
|Name=<nowiki>ExcelSheet</nowiki>
 
|Name=<nowiki>ExcelSheet</nowiki>
 
|Description=<nowiki>An excel sheet</nowiki>
 
|Description=<nowiki>An excel sheet</nowiki>
|Constructors=
+
|InheritsFrom=object|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=<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>}}
Line 8: Line 8:
 
|Methods=
 
|Methods=
 
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>ToArray</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>ToArray</nowiki>|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=<nowiki>sheetName</nowiki>|Description=<nowiki>The sheet to convert</nowiki>|Comma=,}}{{CGscriptParameters_Template|Type=int|Name=<nowiki>fromrow</nowiki>|Description=<nowiki>Skip number of rows</nowiki>}}
 
|Description=<nowiki>Convert the sheet to an array of equal sized arrays</nowiki>}}
 
|Description=<nowiki>Convert the sheet to an array of equal sized arrays</nowiki>}}
 
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>ToHeaders</nowiki>|Parameters=
 
{{CGscriptMethods_Template|ReturnType=array|Name=<nowiki>ToHeaders</nowiki>|Parameters=
 
{{CGscriptParameters_Template|Type=string|Name=<nowiki>sheetName</nowiki>|Description=<nowiki>The sheet to convert</nowiki>}}
 
{{CGscriptParameters_Template|Type=string|Name=<nowiki>sheetName</nowiki>|Description=<nowiki>The sheet to convert</nowiki>}}
 
|Description=<nowiki>Convert the first row to array of strings</nowiki>}}
 
|Description=<nowiki>Convert the first row to array of strings</nowiki>}}
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Description=<nowiki>The string representation of the object.</nowiki>}}
+
{{CGscriptMethods_Template|ReturnType=string|Name=<nowiki>ToString</nowiki>|Inherited=object|Description=<nowiki>The string representation of the object.</nowiki>}}
 
|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=<nowiki>ObjectTypeName</nowiki>|HasGetter=1|Description=<nowiki>The name of the type of object.</nowiki>}}
 
{{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=<nowiki>SheetNames</nowiki>|HasGetter=1|Description=<nowiki>Get list of sheets in the excel file</nowiki>}}
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Description=<nowiki>Get information about this class.</nowiki>}}
+
{{CGscriptProperties_Template|ReturnType=TypeInformation|Name=<nowiki>TypeInformation</nowiki>|HasGetter=1|Inherited=object|Description=<nowiki>Get information about this class.</nowiki>}}
 
}}
 
}}
 
=== Examples ===
 
<source lang="javascript">
 
string filename = "abc";
 
bool isTemp = true;
 
ExcelSheet es = new ExcelSheet(filename, isTemp);
 
string sheet1 = es.SheetNames.First();
 
array headers = es.ToHeaders();
 
array data = es.ToArray(sheet1, 1);
 
ImportManager im = new ImportManager(headers, data, ...);
 
Catglobe.File.Delete(filename, isTemp);
 
</source>
 
 
[[Category:Classes]]
 

Latest revision as of 08:03, 2 July 2020

ExcelSheet



An excel sheet

Parent class

Inherits from object

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", int 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
  • (From object) 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
  • (From object) TypeInformation TypeInformation { get; } - Get information about this class.