Build your own AI office with Univer Office SDK. Bring editing, calculation, collaboration, and file processing into your product for people and AI agents. Built on an extensible open-source core.
TypeScript boardcollaborationdocdocxexceloffce365officepdfpptpptxpresentationsdksheetslidesspreadsheetuniverwordwordprocessorworkspacexlsx
fix(sheets-ui): fix sheet clipboard col tag not closed (#4803)
Wenzhao Hu9e88fac2467c
diff --git a/packages/sheets-ui/src/services/clipboard/usm-to-html/convertor.ts b/packages/sheets-ui/src/services/clipboard/usm-to-html/convertor.tsindex ed115f2930..2264428daf 100644--- a/packages/sheets-ui/src/services/clipboard/usm-to-html/convertor.ts+++ b/packages/sheets-ui/src/services/clipboard/usm-to-html/convertor.ts@@ -16,8 +16,8 @@import type { ICellData, ObjectMatrix } from '@univerjs/core';-import type { ICellDataWithSpanInfo, IClipboardPropertyItem, ISheetClipboardHook } from '../type';import type { IDiscreteRange } from '../../../controllers/utils/range-tools';+import type { ICellDataWithSpanInfo, IClipboardPropertyItem, ISheetClipboardHook } from '../type';/***@@ -87,7 +87,7 @@ function getColStyle(cols: number[], hooks: ISheetClipboardHook[]) {.filter((v) => !!v) as IClipboardPropertyItem[];const mergedProperties = mergeProperties(properties);const str = zipClipboardPropertyItemToString(mergedProperties);- return `<col ${str}>`;+ return `<col ${str} />`;}).join('');@@ -109,18 +109,7 @@ function mergeProperties(properties: IClipboardPropertyItem[]): IClipboardProper}function zipClipboardPropertyItemToString(item: IClipboardPropertyItem) {- return Object.keys(item).reduce((acc, cur) => {- acc += ` ${cur}="${item[cur]}"`;- return acc;- }, '');-}--function getArrayFromTo(f: number, to: number): number[] {- const arr: number[] = [];- for (let i = f; i <= to; i++) {- arr.push(i);- }- return arr;+ return Object.keys(item).reduce((acc, cur) => `${acc} ${cur}="${item[cur]}"`, '');}export class USMToHtmlService {