iExcelCreator.d.ts 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. import { ExportParams } from "./exportParams";
  2. import { XmlElement } from "./iXmlFactory";
  3. export interface ExcelWorksheet {
  4. name: string;
  5. table: ExcelTable;
  6. }
  7. export interface ExcelTable {
  8. columns: ExcelColumn[];
  9. rows: ExcelRow[];
  10. }
  11. export interface ExcelColumn {
  12. min?: number;
  13. max?: number;
  14. width?: number;
  15. s?: number;
  16. hidden?: boolean;
  17. bestFit?: boolean;
  18. }
  19. export interface ExcelRow {
  20. index?: number;
  21. collapsed?: boolean;
  22. hidden?: boolean;
  23. height?: number;
  24. outlineLevel?: number;
  25. s?: number;
  26. cells: ExcelCell[];
  27. }
  28. export interface ExcelCell {
  29. ref?: string;
  30. styleId?: string;
  31. data: ExcelData;
  32. mergeAcross?: number;
  33. }
  34. export interface ExcelData {
  35. type: ExcelDataType | ExcelOOXMLDataType;
  36. value: string | null;
  37. }
  38. export declare type ExcelDataType = 'String' | "Number" | "Boolean" | "DateTime" | "Error";
  39. export interface ExcelExportParams extends ExportParams<ExcelCell[][]> {
  40. sheetName?: string;
  41. suppressTextAsCDATA?: boolean;
  42. exportMode?: "xlsx" | "xml";
  43. rowHeight?: number;
  44. headerRowHeight?: number;
  45. }
  46. export interface IExcelCreator {
  47. exportDataAsExcel(params?: ExcelExportParams): void;
  48. getDataAsExcelXml(params?: ExcelExportParams): string;
  49. }
  50. export interface ExcelStyle {
  51. id: string;
  52. name?: string;
  53. alignment: ExcelAlignment;
  54. borders: ExcelBorders;
  55. font: ExcelFont;
  56. interior: ExcelInterior;
  57. numberFormat: ExcelNumberFormat;
  58. protection: ExcelProtection;
  59. dataType?: string;
  60. }
  61. export interface ExcelProtection {
  62. protected: boolean;
  63. hideFormula: boolean;
  64. }
  65. export interface ExcelNumberFormat {
  66. format: string;
  67. }
  68. export interface ExcelAlignment {
  69. vertical: string;
  70. indent: number;
  71. horizontal: string;
  72. readingOrder: string;
  73. rotate: number;
  74. shrinkToFit: boolean;
  75. verticalText: boolean;
  76. wrapText: boolean;
  77. }
  78. export interface ExcelBorders {
  79. borderBottom: ExcelBorder;
  80. borderLeft: ExcelBorder;
  81. borderTop: ExcelBorder;
  82. borderRight: ExcelBorder;
  83. }
  84. export interface ExcelBorder {
  85. lineStyle: string;
  86. weight: number;
  87. color: string;
  88. }
  89. export interface ExcelFont {
  90. bold: boolean;
  91. color: string;
  92. fontName: string;
  93. italic: boolean;
  94. outline: boolean;
  95. shadow: boolean;
  96. size: number;
  97. strikeThrough: boolean;
  98. underline: string;
  99. verticalAlign: string;
  100. charSet: number;
  101. family: string;
  102. }
  103. export interface ExcelInterior {
  104. color: string;
  105. pattern: string;
  106. patternColor: string;
  107. }
  108. export interface ExcelXMLTemplate {
  109. getTemplate(styleProperties?: ExcelStyle | ExcelWorksheet | ExcelColumn | ExcelRow | ExcelCell): XmlElement;
  110. }
  111. export interface ExcelContentType {
  112. name: 'Default' | 'Override';
  113. ContentType: string;
  114. Extension?: string;
  115. PartName?: string;
  116. }
  117. export declare type ExcelOOXMLDataType = 'str' | 's' | 'inlineStr' | 'n' | 'b' | 'd' | 'e' | 'empty';
  118. export interface ExcelOOXMLTemplate {
  119. getTemplate(config?: any, idx?: number): XmlElement;
  120. convertType?(type: string): string;
  121. }
  122. export interface ExcelRelationship {
  123. Id: string;
  124. Type: string;
  125. Target: string;
  126. }