/** @hidden */
export class ExcelStrings {
/* eslint-disable max-len */
private static XML_STRING = '\r\n';
private static SHARED_STRING_RELATIONSHIP = '';
public static getRels(): string {
return ExcelStrings.XML_STRING + '';
}
public static getApp(worksheetName: string): string {
return ExcelStrings.XML_STRING + `Microsoft Excel0falseWorksheets1${worksheetName}falsefalsefalse16.0300`;
}
public static getCore(): string {
return ExcelStrings.XML_STRING + '2015-06-05T18:17:20Z2015-06-05T18:17:26Z';
}
public static getTheme(): string {
return ExcelStrings.XML_STRING + '';
}
public static getStyles(): string {
return ExcelStrings.XML_STRING +
'';
}
public static getWorkbook(worksheetName: string): string {
return ExcelStrings.XML_STRING + ``;
}
public static getWorksheetRels(): string {
return ExcelStrings.XML_STRING + ``;
}
public static getWorkbookRels(hasSharedStrings): string {
let retVal = ExcelStrings.XML_STRING + ``;
if (hasSharedStrings) {
retVal += ExcelStrings.SHARED_STRING_RELATIONSHIP;
}
retVal += '';
return retVal;
}
public static getSheetXML(dimension: string, freezePane: string, cols: string, sheetData: string, hasTable: boolean, outlineLevel = 0, isHierarchical: boolean): string {
const hasOutline = outlineLevel > 0;
const tableParts = hasTable ? '' : '';
const sheetOutlineProp = hasOutline ? '' : '';
const sOutlineLevel = hasOutline ? `outlineLevelRow="${outlineLevel}"` : '';
const dimensions = isHierarchical ? '' : ``;
// return ExcelStrings.XML_STRING +
// '' + freezePane + '' + cols + sheetData + '' + tableParts + '';
return `${ExcelStrings.XML_STRING}
${sheetOutlineProp}
${dimensions}
${freezePane}
${cols}
${sheetData}
${tableParts}`;
}
public static getSharedStringXML(count: number, uniqueCount: number, table: string): string {
return ExcelStrings.XML_STRING + '' + table + '';
}
public static getContentTypesXML(hasSharedStrings: boolean, hasTable: boolean): string {
let contentTypes = ExcelStrings.XML_STRING +
`
`;
contentTypes += hasSharedStrings ?
` ` : '';
contentTypes += hasTable ?
`` : '';
contentTypes += ``;
return contentTypes;
}
public static getTablesXML(autoFilterDimension: string, tableDimension: string, tableColumns: string, sort: string): string {
return `${ExcelStrings.XML_STRING}
`;
}
/* eslint-enable max-len */
public static getExcelColumn(index: number): string {
// Returns the excel column name for given 0-based index
// For example 27 should return "AB"
let returnString = '';
while (index >= 0) {
const char = index % 26;
returnString = String.fromCharCode(65 + char) + returnString;
index = Math.floor(index / 26) - 1;
}
return returnString;
}
}