mirror of
https://github.com/canna71/obsidian-sheets.git
synced 2026-07-22 08:30:27 +00:00
borders WIP
This commit is contained in:
parent
548e8a2171
commit
699bc5c318
1 changed files with 26 additions and 2 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
import { Workbook } from "exceljs";
|
||||
import { Borders, Workbook } from "exceljs";
|
||||
import { convertThemeColorToRGB, rgbToHex } from "./excelColors";
|
||||
import { CellData, CellStyle, RowData, SheetData } from "x-data-spreadsheet";
|
||||
|
||||
|
|
@ -11,9 +11,19 @@ declare module "x-data-spreadsheet" {
|
|||
|
||||
}
|
||||
|
||||
type borderDir = "top"|"bottom"|"left"|"right";
|
||||
|
||||
export function toSpreadsheet(wb: Workbook) {
|
||||
|
||||
function mapColor(oStyle: CellStyle,border: Partial<Borders>, what: borderDir){
|
||||
if(border[what] && border[what].style && oStyle.border){
|
||||
oStyle.border[what] = [
|
||||
border[what].style?.toString(),
|
||||
"#" + getColor(border[what].color)
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
console.log(wb);
|
||||
|
||||
const out = wb.worksheets.map((ws) => {
|
||||
|
|
@ -75,7 +85,21 @@ export function toSpreadsheet(wb: Workbook) {
|
|||
}
|
||||
|
||||
if (cell.style.border) {
|
||||
//
|
||||
|
||||
|
||||
|
||||
const border = cell.style.border;
|
||||
console.log(border)
|
||||
oStyle.border = {};
|
||||
["top","bottom","left","right"].forEach(what=>{
|
||||
mapColor(oStyle,border,what as borderDir);
|
||||
})
|
||||
// if(border.bottom && border.bottom.style){
|
||||
// oStyle.border.bottom = [
|
||||
// border.bottom.style?.toString(),
|
||||
// "#" + getColor(border.bottom.color)
|
||||
// ]
|
||||
// }
|
||||
}
|
||||
if (cell.style.font) {
|
||||
const font = cell.style.font;
|
||||
|
|
|
|||
Loading…
Reference in a new issue