@mertdeveci55/univer-import-export
Version:
Excel/CSV import and export library for Univer spreadsheets with full format preservation
42 lines (41 loc) • 1.5 kB
TypeScript
/**
* SheetNameHandler - Handles sheet name validation and sanitization for Excel export
*
* Excel has specific rules for sheet names:
* 1. Cannot exceed 31 characters
* 2. Cannot contain: \ / ? * [ ] :
* 3. Cannot start or end with single quotes
* 4. Special characters like >>> need careful handling
*/
export declare class SheetNameHandler {
private static readonly INVALID_CHARS;
private static readonly MAX_LENGTH;
/**
* Sanitize sheet name for Excel export
* This ensures the sheet name is valid for Excel while preserving readability
*/
static sanitizeSheetName(name: string): string;
/**
* Check if a sheet name is valid for Excel
*/
static isValidSheetName(name: string): boolean;
/**
* Create Excel-safe sheet name while preserving special characters when possible
* This method is more sophisticated than sanitizeSheetName and tries to keep
* special characters like >>> intact when they won't cause Excel issues
*/
static createExcelSafeSheetName(name: string): string;
/**
* Get summary of changes made during sanitization
*/
private static getChanges;
/**
* Handle sheet name references in formulas
* Ensures that sheet names with special characters are properly quoted in formulas
*/
static formatSheetNameForFormula(sheetName: string): string;
/**
* Debug method to analyze sheet names
*/
static analyzeSheetName(name: string): any;
}