-
-
Notifications
You must be signed in to change notification settings - Fork 29
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(exports): add Excel custom cell (column) styling (#851)
* feat(exports): add column custom Excel Styling - add `excelExportOptions` and `groupTotalsExcelExportOptions` to allow for custom cell width & styling of every column.
- Loading branch information
1 parent
ad373ab
commit dd92d44
Showing
9 changed files
with
215 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
74 changes: 74 additions & 0 deletions
74
packages/common/src/interfaces/columnExcelExportOption.interface.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/** Excel custom export options (formatting & width) that can be applied to a column */ | ||
export interface ColumnExcelExportOption { | ||
/** | ||
* Option to provide custom Excel styling | ||
* NOTE: this option will completely override any detected column formatting | ||
*/ | ||
style?: ExcelCustomStyling; | ||
|
||
/** Excel column width */ | ||
width?: number; | ||
} | ||
|
||
/** | ||
* Excel Color in ARGB format, for color aren't transparent just use "FF" as prefix. | ||
* For example if the color you want to add is a blue with HTML color "#0000FF", then the excel color we need to add is "FF0000FF" | ||
* Online tool: https://www.myfixguide.com/color-converter/ | ||
*/ | ||
export type ExcelColorStyle = string | { theme: number; }; | ||
export interface ExcelAlignmentStyle { | ||
horizontal?: 'center' | 'fill' | 'general' | 'justify' | 'left' | 'right'; | ||
justifyLastLine?: boolean; | ||
readingOrder?: string; | ||
relativeIndent?: boolean; | ||
shrinkToFit?: boolean; | ||
textRotation?: string | number; | ||
vertical?: 'bottom' | 'distributed' | 'center' | 'justify' | 'top'; | ||
wrapText?: boolean; | ||
} | ||
export type ExcelBorderLine = 'continuous' | 'dash' | 'dashDot' | 'dashDotDot' | 'dotted' | 'double' | 'lineStyleNone' | 'medium' | 'slantDashDot' | 'thin' | 'thick'; | ||
export interface ExcelBorderStyle { | ||
bottom?: { color?: ExcelColorStyle; style?: ExcelBorderLine; }; | ||
top?: { color?: ExcelColorStyle; style?: ExcelBorderLine; }; | ||
left?: { color?: ExcelColorStyle; style?: ExcelBorderLine; }; | ||
right?: { color?: ExcelColorStyle; style?: ExcelBorderLine; }; | ||
diagonal?: any; | ||
outline?: boolean; | ||
diagonalUp?: boolean; | ||
diagonalDown?: boolean; | ||
} | ||
export interface ExcelFillStyle { | ||
type?: 'gradient' | 'pattern'; | ||
patternType?: string; | ||
degree?: number; | ||
fgColor?: ExcelColorStyle; | ||
start?: ExcelColorStyle; | ||
end?: { pureAt?: number; color?: ExcelColorStyle; }; | ||
} | ||
export interface ExcelFontStyle { | ||
bold?: boolean; | ||
color?: ExcelColorStyle; | ||
fontName?: string; | ||
italic?: boolean; | ||
outline?: boolean; | ||
size?: number; | ||
strike?: boolean; | ||
subscript?: boolean; | ||
superscript?: boolean; | ||
underline?: 'single' | 'double' | 'singleAccounting' | 'doubleAccounting'; | ||
} | ||
|
||
/** Excel custom formatting that will be applied to a column */ | ||
export interface ExcelCustomStyling { | ||
alignment?: ExcelAlignmentStyle; | ||
border?: ExcelBorderStyle; | ||
fill?: ExcelFillStyle; | ||
font?: ExcelFontStyle; | ||
format?: string; | ||
protection?: { | ||
locked?: boolean; | ||
hidden?: boolean; | ||
}; | ||
/** style id */ | ||
style?: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.