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: page width should great than 0 (#1402)
Ran Luo281a4b9be488
diff --git a/examples/src/data/docs/default-document-data-cn.ts b/examples/src/data/docs/default-document-data-cn.tsindex f7530cd4c2..d39ff0746f 100644--- a/examples/src/data/docs/default-document-data-cn.ts+++ b/examples/src/data/docs/default-document-data-cn.ts@@ -27,7 +27,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {st: 0,ed: 4,ts: {- fs: 24,+ fs: 20,ff: 'Microsoft YaHei',cl: {rgb: 'rgb(255, 255, 255)',@@ -42,7 +42,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {st: 5,ed: 9,ts: {- fs: 18,+ fs: 16,ff: 'Microsoft YaHei',cl: {rgb: 'rgb(30, 30, 30)',@@ -54,7 +54,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {st: 9,ed: 13,ts: {- fs: 18,+ fs: 16,ff: 'Microsoft YaHei',cl: {rgb: 'rgb(30, 30, 30)',@@ -66,7 +66,7 @@ export const DEFAULT_DOCUMENT_DATA_CN: IDocumentData = {st: 13,ed: 3057,ts: {- fs: 14,+ fs: 12,ff: 'Microsoft YaHei',cl: {rgb: 'rgb(30, 30, 30)',diff --git a/packages/engine-render/src/components/docs/block/paragraph/layout-ruler.ts b/packages/engine-render/src/components/docs/block/paragraph/layout-ruler.tsindex 61e6056b0e..4c6ecbcda2 100644--- a/packages/engine-render/src/components/docs/block/paragraph/layout-ruler.ts+++ b/packages/engine-render/src/components/docs/block/paragraph/layout-ruler.ts@@ -271,6 +271,14 @@ function _lineOperator(if (!columnInfo) return;const column = columnInfo!.column;++ // If the page width < marginLeft + marginRight, will trigger infinity loop, so return it first.+ // The best solution is to do data checks and data repairs, and pass the correct data to the render layer.+ if (column.width <= 0) {+ console.error('The column width is less than 0, need to adjust page width to make it great than 0');+ return;+ }+const line = getLastLineByColumn(column);const ascent = Math.max(...spanGroup.map((span) => span.bBox.ba));