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(sheet): fit doc render
liuyang.0809db969b64e4af
diff --git a/package.json b/package.jsonindex d759cdda9e..776b60e52a 100644--- a/package.json+++ b/package.json@@ -76,5 +76,8 @@"packages/**/src/**/*.ts?(x)": ["eslint --fix"]+ },+ "dependencies": {+ "pnpm": "^8.6.4"}}diff --git a/packages/base-docs/src/Basics/DemoData.ts b/packages/base-docs/src/Basics/DemoData.tsindex bb6a3016b2..8c31b2208e 100644--- a/packages/base-docs/src/Basics/DemoData.ts+++ b/packages/base-docs/src/Basics/DemoData.ts@@ -1,6 +1,5 @@import {BaselineOffset,- BlockType,BooleanNumber,BulletAlignment,ColumnSeparatorType,@@ -8,7 +7,6 @@ import {IDocumentData,ObjectRelativeFromH,ObjectRelativeFromV,- ParagraphElementType,PositionedObjectLayoutType,SectionType,WrapTextType,@@ -123,243 +121,135 @@ export const DOCS_DEMO_DATA: IDocumentData = {},},body: {- blockElements: [+ dataStream: `在“第1题”工作表中完成以下操作\b上标日期列单元格数据验证,限制只能输入日期(介于1949年1月1日至2099年1月1日)\r细化埋点上报链路和指标方案梳理目前通过每日定时任务发送报告\r自2018年首届进博会举办以来,进博会已经成为全球新品的首发地、前沿技术的首选地、创新服务的首推地。中国这十年”对外开放成就展湖北展区主要以图文、图表、数据、视频、企业展品、实物模型、光电科技等体现湖北十年开放成就、重大开放平台及产业。湖北省共计17家企业、机构的展品将在这一展区展示\r国家主席习近平以视频方式出席在上海举行的第五届中国国际进口博览会开幕式并发表题为《共创开放繁荣的美好未来》的致辞中国将推动各国各方共享深化国际合作机遇,全面深入参与世界贸易组织改革谈判\r中国男排两名现役国手彭世坤和张秉龙分别效力的三得利太阳鸟和东京大熊本轮遭遇。双方经过激战,主场作战的卫冕冠军三得利技高一筹3-2逆转击败对手,力夺第3场胜利\r\n`,+ textRuns: [{- blockId: 'oneParagraph',st: 0,- ed: 59,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 0,- textStyle: {- fs: 20,- },+ ed: 15,+ ts: {+ fs: 12,+ bg: {+ rgb: 'rgb(200,0,90)',+ },+ cl: {+ rgb: 'rgb(255,130,0)',},- elements: [- {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '在“第1题”工作表中完成以下操作',- ts: {- fs: 12,- bg: {- rgb: 'rgb(200,0,90)',- },- cl: {- rgb: 'rgb(255,130,0)',- },- },- },- },- {- eId: 'shapeTest1',- et: ParagraphElementType.DRAWING,- ed: 0,- st: 0,- },- {- eId: 'smallSub',- st: 16,- ed: 17,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '上标',- ts: {- fs: 14,- bg: {- rgb: 'rgb(2,128,2)',- },- cl: {- rgb: 'rgb(0,1,55)',- },- va: BaselineOffset.SUPERSCRIPT,- },- },- },- {- eId: 'twoElement',- st: 18,- ed: 59,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '日期列单元格数据验证,限制只能输入日期(介于1949年1月1日至2099年1月1日)',- ts: {- fs: 14,- bg: {- rgb: 'rgb(90,128,255)',- },- cl: {- rgb: 'rgb(0,1,255)',- },- },- },- },- ],},},{- blockId: 'twoParagraph',- st: 60,- ed: 88,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 1,- textStyle: {- fs: 20,- },+ st: 17,+ ed: 18,+ ts: {+ fs: 14,+ bg: {+ rgb: 'rgb(2,128,2)',+ },+ cl: {+ rgb: 'rgb(0,1,55)',},- elements: [- {- eId: 'oneElement',- st: 60,- ed: 74,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '细化埋点上报链路和指标方案梳理',- },- },- {- eId: 'twoElement',- st: 75,- ed: 88,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '目前通过每日定时任务发送报告',- },- },- ],+ va: BaselineOffset.SUPERSCRIPT,},},{- blockId: 'threeParagraph',- st: 89,- ed: 230,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 0,- textStyle: {- fs: 20,- },+ st: 19,+ ed: 60,+ ts: {+ fs: 14,+ bg: {+ rgb: 'rgb(90,128,255)',+ },+ cl: {+ rgb: 'rgb(0,1,255)',},- elements: [- {- eId: 'oneElement',- st: 89,- ed: 138,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '自2018年首届进博会举办以来,进博会已经成为全球新品的首发地、前沿技术的首选地、创新服务的首推地。',- },- },- {- eId: 'twoElement',- st: 139,- ed: 230,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '中国这十年”对外开放成就展湖北展区主要以图文、图表、数据、视频、企业展品、实物模型、光电科技等体现湖北十年开放成就、重大开放平台及产业。湖北省共计17家企业、机构的展品将在这一展区展示',- },- },- ],},},++ {+ st: 62,+ ed: 90,+ },++ {+ st: 92,+ ed: 233,+ },+{- blockId: 'fourParagraph',- st: 231,- ed: 322,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 1,- textStyle: {- fs: 20,- },+ st: 235,+ ed: 326,+ },++ {+ st: 328,+ ed: 405,+ },+ ],+ paragraphs: [+ {+ startIndex: 60,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 0,+ textStyle: {+ fs: 20,},- elements: [- {- eId: 'oneElement',- st: 231,- ed: 286,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '国家主席习近平以视频方式出席在上海举行的第五届中国国际进口博览会开幕式并发表题为《共创开放繁荣的美好未来》的致辞',- },- },- {- eId: 'twoElement',- st: 287,- ed: 322,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '中国将推动各国各方共享深化国际合作机遇,全面深入参与世界贸易组织改革谈判',- },- },- ],},},{- blockId: 'fiveParagraph',- st: 323,- ed: 400,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 2,- textStyle: {- fs: 20,- },+ startIndex: 91,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 1,+ textStyle: {+ fs: 20,},- elements: [- {- eId: 'oneElement',- st: 323,- ed: 360,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '中国男排两名现役国手彭世坤和张秉龙分别效力的三得利太阳鸟和东京大熊本轮遭遇。',- },- },- {- eId: 'twoElement',- st: 361,- ed: 400,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '双方经过激战,主场作战的卫冕冠军三得利技高一筹3-2逆转击败对手,力夺第3场胜利',- },- },- ],},},{- blockId: 'oneSectionBreak',- st: 0,- ed: 0,- blockType: BlockType.SECTION_BREAK,- sectionBreak: {- columnProperties: [- {- width: 200,- paddingEnd: 20,- },- ],- columnSeparatorType: ColumnSeparatorType.NONE,- sectionType: SectionType.SECTION_TYPE_UNSPECIFIED,- // textDirection: textDirectionDocument,- // contentDirection: textDirection!,+ startIndex: 234,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 1,+ textStyle: {+ fs: 20,+ },},},+ {+ startIndex: 327,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 1,+ textStyle: {+ fs: 20,+ },+ },+ },+ {+ startIndex: 406,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 2,+ textStyle: {+ fs: 20,+ },+ },+ },+ ],+ sectionBreaks: [+ {+ startIndex: 407,+ columnProperties: [+ {+ width: 200,+ paddingEnd: 20,+ },+ ],+ columnSeparatorType: ColumnSeparatorType.NONE,+ sectionType: SectionType.SECTION_TYPE_UNSPECIFIED,+ // textDirection: textDirectionDocument,+ // contentDirection: textDirection!,+ },],},documentStyle: {diff --git a/packages/base-render/src/Component/Sheets/Extensions/Font.ts b/packages/base-render/src/Component/Sheets/Extensions/Font.tsindex 27e18b0e66..db8bacb7a5 100644--- a/packages/base-render/src/Component/Sheets/Extensions/Font.ts+++ b/packages/base-render/src/Component/Sheets/Extensions/Font.ts@@ -104,7 +104,7 @@ export class Font extends SheetExtension {const cellHeight = endY - startY;if (wrapStrategy === WrapStrategy.WRAP && angle === 0) {- documentSkeleton.updateDocumentDataPageSize(cellWidth);+ documentSkeleton.getModel().updateDocumentDataPageSize(cellWidth);documentSkeleton.calculate();}diff --git a/packages/base-render/src/Component/Sheets/SheetSkeleton.ts b/packages/base-render/src/Component/Sheets/SheetSkeleton.tsindex cea759fae4..fa41a4c57f 100644--- a/packages/base-render/src/Component/Sheets/SheetSkeleton.ts+++ b/packages/base-render/src/Component/Sheets/SheetSkeleton.ts@@ -787,32 +787,11 @@ export class SpreadsheetSkeleton extends Skeleton {paragraph.paragraphStyle.horizontalAlign = horizontalAlign;}- // const blockElements = document.body.blockElements;- // for (let blockElement of blockElements) {- // // if (blockElement.blockType === BlockType.SECTION_BREAK) {- // // if (!blockElement.sectionBreak) {- // // blockElement.sectionBreak = {};- // // }-- // // blockElement.sectionBreak.renderConfig = renderConfig;- // // } else- // if (blockElement.blockType === BlockType.PARAGRAPH) {- // if (!blockElement.paragraph) {- // continue;- // }-- // if (!blockElement.paragraph.paragraphStyle) {- // blockElement.paragraph.paragraphStyle = {};- // }-- // blockElement.paragraph.paragraphStyle.horizontalAlign = horizontalAlign;- // }- // }return new DocumentModelSimple(document);}private _getDocumentDataByStyle(content: string, textStyle: ITextStyle, config: CellOtherConfig) {- const contentLength = content.length - 1;+ const contentLength = content.length;const {textRotation = { a: 0, v: BooleanNumber.FALSE },textDirection = TextDirection.UNSPECIFIED,@@ -856,44 +835,6 @@ export class SpreadsheetSkeleton extends Skeleton {},},],- // blockElements: [- // {- // blockId: 'oneParagraph',- // st: 0,- // ed: contentLength,- // blockType: BlockType.PARAGRAPH,- // paragraph: {- // paragraphStyle: {- // horizontalAlign,- // },- // elements: [- // {- // eId: 'oneElement',- // st: 0,- // ed: contentLength,- // et: ParagraphElementType.TEXT_RUN,- // tr: {- // ct: content,- // ts: textStyle,- // },- // },- // ],- // },- // },- // // oneSectionBreak: {- // // blockId: 'oneSectionBreak',- // // st: 0,- // // ed: 0,- // // blockType: BlockType.SECTION_BREAK,- // // sectionBreak: {- // // columnProperties: [],- // // columnSeparatorType: ColumnSeparatorType.NONE,- // // sectionType: SectionType.SECTION_TYPE_UNSPECIFIED,- // // // textDirection: textDirectionDocument,- // // // contentDirection: textDirection!,- // // },- // // },- // ],},documentStyle: {pageSize: {@@ -942,17 +883,16 @@ export class SpreadsheetSkeleton extends Skeleton {return {};}const { ff, fs, it, bl, ul, st, ol, cl, bg, bd } = format;-- return {- ff,- fs,- it,- bl,- ul,- st,- ol,- cl,- };+ const style: IStyleBase = {};+ ff && (style.ff = ff);+ fs && (style.fs = fs);+ it && (style.it = it);+ bl && (style.bl = bl);+ ul && (style.ul = ul);+ st && (style.st = st);+ ol && (style.ol = ol);+ cl && (style.cl = cl);+ return style;}private _getOtherStyle(format?: Nullable<IStyleData>) {diff --git a/packages/base-render/src/Locale/en.ts b/packages/base-render/src/Locale/en.tsindex 2748de41eb..17a8360000 100644--- a/packages/base-render/src/Locale/en.ts+++ b/packages/base-render/src/Locale/en.ts@@ -2,7 +2,7 @@ export default {renderFont: {defaultFont: 'Times New Roman',fontList: ['Times New Roman', 'Arial', 'Tahoma', 'Verdana'],- defaultFontSize: 9,+ defaultFontSize: 14,unit: 'pt',},};diff --git a/packages/base-render/src/Shape/RichText.ts b/packages/base-render/src/Shape/RichText.tsindex 75252d97c6..1a6fe3ad0d 100644--- a/packages/base-render/src/Shape/RichText.ts+++ b/packages/base-render/src/Shape/RichText.ts@@ -245,39 +245,6 @@ export class RichText extends BaseObject {ed: contentLength - 1,},],- // blockElements: [- // {- // blockId: 'oneParagraph',- // st: 0,- // ed: contentLength,- // blockType: BlockType.PARAGRAPH,- // paragraph: {- // elements: [- // {- // eId: 'oneElement',- // st: 0,- // ed: contentLength,- // et: ParagraphElementType.TEXT_RUN,- // tr: {- // ct: text,- // ts: {- // fs: this._fs || 14,- // ff: this._ff,- // it: this._it,- // bl: this._bl,- // ul: this._ul,- // st: this._st,- // ol: this._ol,- // bg: this._bg,- // bd: this._bd,- // cl: this._cl,- // },- // },- // },- // ],- // },- // },- // ],},documentStyle: {pageSize: {diff --git a/packages/base-sheets/src/View/Views/OtherViewTest.ts b/packages/base-sheets/src/View/Views/OtherViewTest.tsindex 4f83ff2caa..12d7b6374c 100644--- a/packages/base-sheets/src/View/Views/OtherViewTest.ts+++ b/packages/base-sheets/src/View/Views/OtherViewTest.ts@@ -1,15 +1,15 @@import { getColor, Path, Picture, Rect, Circle, RichText, Scene } from '@univerjs/base-render';import {BaselineOffset,- BlockType,BooleanNumber,BulletAlignment,+ ColumnSeparatorType,GlyphType,IDocumentData,ObjectRelativeFromH,ObjectRelativeFromV,- ParagraphElementType,PositionedObjectLayoutType,+ SectionType,WrapTextType,} from '@univerjs/core';import { SheetPlugin } from '../../SheetPlugin';@@ -124,279 +124,136 @@ const richTextTest: IDocumentData = {},},body: {- blockElements: {- oneParagraph: {- blockId: 'oneParagraph',+ dataStream: `在“第1题”工作表中完成以下操作\b上标日期列单元格数据验证,限制只能输入日期(介于1949年1月1日至2099年1月1日)\r细化埋点上报链路和指标方案梳理目前通过每日定时任务发送报告\r自2018年首届进博会举办以来,进博会已经成为全球新品的首发地、前沿技术的首选地、创新服务的首推地。中国这十年”对外开放成就展湖北展区主要以图文、图表、数据、视频、企业展品、实物模型、光电科技等体现湖北十年开放成就、重大开放平台及产业。湖北省共计17家企业、机构的展品将在这一展区展示\r国家主席习近平以视频方式出席在上海举行的第五届中国国际进口博览会开幕式并发表题为《共创开放繁荣的美好未来》的致辞中国将推动各国各方共享深化国际合作机遇,全面深入参与世界贸易组织改革谈判\r中国男排两名现役国手彭世坤和张秉龙分别效力的三得利太阳鸟和东京大熊本轮遭遇。双方经过激战,主场作战的卫冕冠军三得利技高一筹3-2逆转击败对手,力夺第3场胜利\r\n`,+ textRuns: [+ {st: 0,ed: 15,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 0,- textStyle: {- fs: 20,- },+ ts: {+ fs: 12,+ bg: {+ rgb: 'rgb(200,0,90)',},- elements: {- oneElement: {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '在“第1题”工作表中完成以下操作',- ts: {- fs: 12,- bg: {- rgb: 'rgb(200,0,90)',- },- cl: {- rgb: 'rgb(255,130,0)',- },- },- },- },- smallSub: {- eId: 'smallSub',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '上标',- ts: {- fs: 14,- bg: {- rgb: 'rgb(2,128,2)',- },- cl: {- rgb: 'rgb(0,1,55)',- },- va: BaselineOffset.SUPERSCRIPT,- },- },- },- twoElement: {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '日期列单元格数据验证,限制只能输入日期(介于1949年1月1日至2099年1月1日)',- ts: {- fs: 14,- bg: {- rgb: 'rgb(90,128,255)',- },- cl: {- rgb: 'rgb(0,1,255)',- },- },- },- },+ cl: {+ rgb: 'rgb(255,130,0)',},- elementOrder: [- {- elementId: 'oneElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- {- elementId: 'shapeTest1',- paragraphElementType: ParagraphElementType.DRAWING,- },- {- elementId: 'smallSub',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- {- elementId: 'twoElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- ],},},- twoParagraph: {- blockId: 'twoParagraph',- st: 0,- ed: 15,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 1,- textStyle: {- fs: 20,- },+ {+ st: 17,+ ed: 18,+ ts: {+ fs: 14,+ bg: {+ rgb: 'rgb(2,128,2)',},- elements: {- oneElement: {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '细化埋点上报链路和指标方案梳理',- },- },- twoElement: {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '目前通过每日定时任务发送报告',- },- },+ cl: {+ rgb: 'rgb(0,1,55)',},- elementOrder: [- {- elementId: 'oneElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- {- elementId: 'twoElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- ],+ va: BaselineOffset.SUPERSCRIPT,},},- threeParagraph: {- blockId: 'threeParagraph',- st: 0,- ed: 15,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 0,- textStyle: {- fs: 20,- },+ {+ st: 19,+ ed: 60,+ ts: {+ fs: 14,+ bg: {+ rgb: 'rgb(90,128,255)',},- elements: {- oneElement: {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '自2018年首届进博会举办以来,进博会已经成为全球新品的首发地、前沿技术的首选地、创新服务的首推地。',- },- },- twoElement: {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '中国这十年”对外开放成就展湖北展区主要以图文、图表、数据、视频、企业展品、实物模型、光电科技等体现湖北十年开放成就、重大开放平台及产业。湖北省共计17家企业、机构的展品将在这一展区展示',- },- },+ cl: {+ rgb: 'rgb(0,1,255)',},- elementOrder: [- {- elementId: 'oneElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- {- elementId: 'twoElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- ],},},- fourParagraph: {- blockId: 'fourParagraph',- st: 0,- ed: 15,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 1,- textStyle: {- fs: 20,- },++ {+ st: 62,+ ed: 90,+ },++ {+ st: 92,+ ed: 233,+ },++ {+ st: 235,+ ed: 326,+ },++ {+ st: 328,+ ed: 405,+ },+ ],+ paragraphs: [+ {+ startIndex: 60,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 0,+ textStyle: {+ fs: 20,},- elements: {- oneElement: {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '国家主席习近平以视频方式出席在上海举行的第五届中国国际进口博览会开幕式并发表题为《共创开放繁荣的美好未来》的致辞',- },- },- twoElement: {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '中国将推动各国各方共享深化国际合作机遇,全面深入参与世界贸易组织改革谈判',- },- },+ },+ },+ {+ startIndex: 91,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 1,+ textStyle: {+ fs: 20,},- elementOrder: [- {- elementId: 'oneElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- {- elementId: 'twoElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- ],},},- fiveParagraph: {- blockId: 'fiveParagraph',- st: 0,- ed: 15,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 2,- textStyle: {- fs: 20,- },+ {+ startIndex: 234,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 1,+ textStyle: {+ fs: 20,},- elements: {- oneElement: {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '中国男排两名现役国手彭世坤和张秉龙分别效力的三得利太阳鸟和东京大熊本轮遭遇。',- },- },- twoElement: {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '双方经过激战,主场作战的卫冕冠军三得利技高一筹3-2逆转击败对手,力夺第3场胜利',- },- },+ },+ },+ {+ startIndex: 327,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 1,+ textStyle: {+ fs: 20,},- elementOrder: [- {- elementId: 'oneElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- {- elementId: 'twoElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- ],},},- },- blockElementOrder: ['oneParagraph', 'twoParagraph', 'threeParagraph', 'fourParagraph', 'fiveParagraph'],+ {+ startIndex: 406,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 2,+ textStyle: {+ fs: 20,+ },+ },+ },+ ],+ sectionBreaks: [+ {+ startIndex: 407,+ columnProperties: [+ {+ width: 200,+ paddingEnd: 20,+ },+ ],+ columnSeparatorType: ColumnSeparatorType.NONE,+ sectionType: SectionType.SECTION_TYPE_UNSPECIFIED,+ // textDirection: textDirectionDocument,+ // contentDirection: textDirection!,+ },+ ],},documentStyle: {pageSize: {diff --git a/packages/base-slides/src/Basics/DemoData.ts b/packages/base-slides/src/Basics/DemoData.tsindex 2409539ce0..8a193315da 100644--- a/packages/base-slides/src/Basics/DemoData.ts+++ b/packages/base-slides/src/Basics/DemoData.ts@@ -1,14 +1,14 @@import {BaselineOffset,- BlockType,BooleanNumber,BulletAlignment,+ ColumnSeparatorType,GlyphType,IDocumentData,ObjectRelativeFromH,ObjectRelativeFromV,- ParagraphElementType,PositionedObjectLayoutType,+ SectionType,WrapTextType,} from '@univerjs/core';@@ -121,279 +121,136 @@ export const docsDemoData: IDocumentData = {},},body: {- blockElements: {- oneParagraph: {- blockId: 'oneParagraph',+ dataStream: `在“第1题”工作表中完成以下操作\b上标日期列单元格数据验证,限制只能输入日期(介于1949年1月1日至2099年1月1日)\r细化埋点上报链路和指标方案梳理目前通过每日定时任务发送报告\r自2018年首届进博会举办以来,进博会已经成为全球新品的首发地、前沿技术的首选地、创新服务的首推地。中国这十年”对外开放成就展湖北展区主要以图文、图表、数据、视频、企业展品、实物模型、光电科技等体现湖北十年开放成就、重大开放平台及产业。湖北省共计17家企业、机构的展品将在这一展区展示\r国家主席习近平以视频方式出席在上海举行的第五届中国国际进口博览会开幕式并发表题为《共创开放繁荣的美好未来》的致辞中国将推动各国各方共享深化国际合作机遇,全面深入参与世界贸易组织改革谈判\r中国男排两名现役国手彭世坤和张秉龙分别效力的三得利太阳鸟和东京大熊本轮遭遇。双方经过激战,主场作战的卫冕冠军三得利技高一筹3-2逆转击败对手,力夺第3场胜利\r\n`,+ textRuns: [+ {st: 0,ed: 15,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 0,- textStyle: {- fs: 20,- },+ ts: {+ fs: 12,+ bg: {+ rgb: 'rgb(200,0,90)',},- elements: {- oneElement: {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '在“第1题”工作表中完成以下操作',- ts: {- fs: 12,- bg: {- rgb: 'rgb(200,0,90)',- },- cl: {- rgb: 'rgb(255,130,0)',- },- },- },- },- smallSub: {- eId: 'smallSub',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '上标',- ts: {- fs: 14,- bg: {- rgb: 'rgb(2,128,2)',- },- cl: {- rgb: 'rgb(0,1,55)',- },- va: BaselineOffset.SUPERSCRIPT,- },- },- },- twoElement: {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '日期列单元格数据验证,限制只能输入日期(介于1949年1月1日至2099年1月1日)',- ts: {- fs: 14,- bg: {- rgb: 'rgb(90,128,255)',- },- cl: {- rgb: 'rgb(0,1,255)',- },- },- },- },+ cl: {+ rgb: 'rgb(255,130,0)',},- elementOrder: [- {- elementId: 'oneElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- {- elementId: 'shapeTest1',- paragraphElementType: ParagraphElementType.DRAWING,- },- {- elementId: 'smallSub',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- {- elementId: 'twoElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- ],},},- twoParagraph: {- blockId: 'twoParagraph',- st: 0,- ed: 15,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 1,- textStyle: {- fs: 20,- },+ {+ st: 17,+ ed: 18,+ ts: {+ fs: 14,+ bg: {+ rgb: 'rgb(2,128,2)',},- elements: {- oneElement: {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '细化埋点上报链路和指标方案梳理',- },- },- twoElement: {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '目前通过每日定时任务发送报告',- },- },+ cl: {+ rgb: 'rgb(0,1,55)',},- elementOrder: [- {- elementId: 'oneElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- {- elementId: 'twoElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- ],+ va: BaselineOffset.SUPERSCRIPT,},},- threeParagraph: {- blockId: 'threeParagraph',- st: 0,- ed: 15,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 0,- textStyle: {- fs: 20,- },+ {+ st: 19,+ ed: 60,+ ts: {+ fs: 14,+ bg: {+ rgb: 'rgb(90,128,255)',},- elements: {- oneElement: {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '自2018年首届进博会举办以来,进博会已经成为全球新品的首发地、前沿技术的首选地、创新服务的首推地。',- },- },- twoElement: {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '中国这十年”对外开放成就展湖北展区主要以图文、图表、数据、视频、企业展品、实物模型、光电科技等体现湖北十年开放成就、重大开放平台及产业。湖北省共计17家企业、机构的展品将在这一展区展示',- },- },+ cl: {+ rgb: 'rgb(0,1,255)',},- elementOrder: [- {- elementId: 'oneElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- {- elementId: 'twoElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- ],},},- fourParagraph: {- blockId: 'fourParagraph',- st: 0,- ed: 15,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 1,- textStyle: {- fs: 20,- },++ {+ st: 62,+ ed: 90,+ },++ {+ st: 92,+ ed: 233,+ },++ {+ st: 235,+ ed: 326,+ },++ {+ st: 328,+ ed: 405,+ },+ ],+ paragraphs: [+ {+ startIndex: 60,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 0,+ textStyle: {+ fs: 20,},- elements: {- oneElement: {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '国家主席习近平以视频方式出席在上海举行的第五届中国国际进口博览会开幕式并发表题为《共创开放繁荣的美好未来》的致辞',- },- },- twoElement: {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '中国将推动各国各方共享深化国际合作机遇,全面深入参与世界贸易组织改革谈判',- },- },+ },+ },+ {+ startIndex: 91,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 1,+ textStyle: {+ fs: 20,},- elementOrder: [- {- elementId: 'oneElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- {- elementId: 'twoElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- ],},},- fiveParagraph: {- blockId: 'fiveParagraph',- st: 0,- ed: 15,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 2,- textStyle: {- fs: 20,- },+ {+ startIndex: 234,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 1,+ textStyle: {+ fs: 20,},- elements: {- oneElement: {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '中国男排两名现役国手彭世坤和张秉龙分别效力的三得利太阳鸟和东京大熊本轮遭遇。',- },- },- twoElement: {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '双方经过激战,主场作战的卫冕冠军三得利技高一筹3-2逆转击败对手,力夺第3场胜利',- },- },+ },+ },+ {+ startIndex: 327,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 1,+ textStyle: {+ fs: 20,},- elementOrder: [- {- elementId: 'oneElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- {- elementId: 'twoElement',- paragraphElementType: ParagraphElementType.TEXT_RUN,- },- ],},},- },- blockElementOrder: ['oneParagraph', 'twoParagraph', 'threeParagraph', 'fourParagraph', 'fiveParagraph'],+ {+ startIndex: 406,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 2,+ textStyle: {+ fs: 20,+ },+ },+ },+ ],+ sectionBreaks: [+ {+ startIndex: 407,+ columnProperties: [+ {+ width: 200,+ paddingEnd: 20,+ },+ ],+ columnSeparatorType: ColumnSeparatorType.NONE,+ sectionType: SectionType.SECTION_TYPE_UNSPECIFIED,+ // textDirection: textDirectionDocument,+ // contentDirection: textDirection!,+ },+ ],},documentStyle: {pageSize: {diff --git a/packages/common-plugin-data/src/Sheets/DEFAULT_WORKBOOK_DATA.ts b/packages/common-plugin-data/src/Sheets/DEFAULT_WORKBOOK_DATA.tsindex f7fdd96c15..02aba29b86 100644--- a/packages/common-plugin-data/src/Sheets/DEFAULT_WORKBOOK_DATA.ts+++ b/packages/common-plugin-data/src/Sheets/DEFAULT_WORKBOOK_DATA.ts@@ -1,7 +1,5 @@import {IDocumentData,- BlockType,- ParagraphElementType,BaselineOffset,IWorkbookConfig,LocaleType,@@ -18,6 +16,8 @@ import {WrapTextType,BulletAlignment,GlyphType,+ ColumnSeparatorType,+ SectionType,} from '@univerjs/core';const richTextTestFloat: IDocumentData = {@@ -129,224 +129,74 @@ const richTextTestFloat: IDocumentData = {},},body: {- blockElements: [+ dataStream: `在“第1题”工作表中完成以下操作\b上标日期列单元格数据验证,限制只能输入日期(介于1949年1月1日至2099年1月1日)\r\n`,+ textRuns: [{- blockId: 'oneParagraph',st: 0,ed: 15,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 0,- textStyle: {- fs: 20,- },- },- elements: [- {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '在“第1题”工作表中完成以下操作',- ts: {- fs: 12,- bg: {- rgb: 'rgb(200,0,90)',- },- cl: {- rgb: 'rgb(255,130,0)',- },- },- },- },- {- eId: 'shapeTest1',- et: ParagraphElementType.DRAWING,- st: 0,- ed: 0,- },- {- eId: 'smallSub',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '上标',- ts: {- fs: 14,- bg: {- rgb: 'rgb(2,128,2)',- },- cl: {- rgb: 'rgb(0,1,55)',- },- va: BaselineOffset.SUPERSCRIPT,- },- },- },- {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '日期列单元格数据验证,限制只能输入日期(介于1949年1月1日至2099年1月1日)',- ts: {- fs: 14,- bg: {- rgb: 'rgb(90,128,255)',- },- cl: {- rgb: 'rgb(0,1,255)',- },- },- },- },- ],+ ts: {+ fs: 12,+ bg: {+ rgb: 'rgb(200,0,90)',+ },+ cl: {+ rgb: 'rgb(255,130,0)',+ },},},{- blockId: 'twoParagraph',- st: 0,- ed: 15,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 1,- textStyle: {- fs: 20,- },- },- elements: [- {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '细化埋点上报链路和指标方案梳理',- },- },- {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '目前通过每日定时任务发送报告',- },- },- ],+ st: 17,+ ed: 18,+ ts: {+ fs: 14,+ bg: {+ rgb: 'rgb(2,128,2)',+ },+ cl: {+ rgb: 'rgb(0,1,55)',+ },+ va: BaselineOffset.SUPERSCRIPT,},},{- blockId: 'threeParagraph',- st: 0,- ed: 15,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 0,- textStyle: {- fs: 20,- },- },- elements: [- {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '自2018年首届进博会举办以来,进博会已经成为全球新品的首发地、前沿技术的首选地、创新服务的首推地。',- },- },- {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '中国这十年”对外开放成就展湖北展区主要以图文、图表、数据、视频、企业展品、实物模型、光电科技等体现湖北十年开放成就、重大开放平台及产业。湖北省共计17家企业、机构的展品将在这一展区展示',- },- },- ],+ st: 19,+ ed: 60,+ ts: {+ fs: 14,+ bg: {+ rgb: 'rgb(90,128,255)',+ },+ cl: {+ rgb: 'rgb(0,1,255)',+ },},},+ ],+ paragraphs: [{- blockId: 'fourParagraph',- st: 0,- ed: 15,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 1,- textStyle: {- fs: 20,- },- },- elements: [- {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '国家主席习近平以视频方式出席在上海举行的第五届中国国际进口博览会开幕式并发表题为《共创开放繁荣的美好未来》的致辞',- },- },- {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '中国将推动各国各方共享深化国际合作机遇,全面深入参与世界贸易组织改革谈判',- },- },- ],+ startIndex: 60,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 0,+ textStyle: {+ fs: 20,+ },},},+ ],+ sectionBreaks: [{- blockId: 'fiveParagraph',- st: 0,- ed: 15,- blockType: BlockType.PARAGRAPH,- paragraph: {- bullet: {- listId: 'testBullet',- nestingLevel: 2,- textStyle: {- fs: 20,- },- },- elements: [- {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '中国男排两名现役国手彭世坤和张秉龙分别效力的三得利太阳鸟和东京大熊本轮遭遇。',- },- },- {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '双方经过激战,主场作战的卫冕冠军三得利技高一筹3-2逆转击败对手,力夺第3场胜利',- },- },- ],- },+ startIndex: 61,+ columnProperties: [+ {+ width: 200,+ paddingEnd: 20,+ },+ ],+ columnSeparatorType: ColumnSeparatorType.NONE,+ sectionType: SectionType.SECTION_TYPE_UNSPECIFIED,+ // textDirection: textDirectionDocument,+ // contentDirection: textDirection!,},],},@@ -365,72 +215,75 @@ const richTextTestFloat: IDocumentData = {const richTextTest: IDocumentData = {id: 'd',body: {- blockElements: [+ dataStream: `在“第1题”工作表中完成以下操作\b上标日期列单元格数据验证,限制只能输入日期(介于1949年1月1日至2099年1月1日)\r\n`,+ textRuns: [{- blockId: 'oneParagraph',st: 0,ed: 15,- blockType: BlockType.PARAGRAPH,- paragraph: {- elements: [- {- eId: 'oneElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '在“第1题”工作表中完成以下操作',- ts: {- fs: 12,- bg: {- rgb: 'rgb(200,0,90)',- },- cl: {- rgb: 'rgb(255,130,0)',- },- },- },- },- {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '上标',- ts: {- fs: 14,- bg: {- rgb: 'rgb(2,128,2)',- },- cl: {- rgb: 'rgb(0,1,55)',- },- va: BaselineOffset.SUPERSCRIPT,- },- },- },- {- eId: 'twoElement',- st: 0,- ed: 15,- et: ParagraphElementType.TEXT_RUN,- tr: {- ct: '日期列单元格数据验证,限制只能输入日期(介于1949年1月1日至2099年1月1日)',- ts: {- fs: 14,- bg: {- rgb: 'rgb(90,128,255)',- },- cl: {- rgb: 'rgb(0,1,255)',- },- },- },- },- ],+ ts: {+ fs: 12,+ bg: {+ rgb: 'rgb(200,0,90)',+ },+ cl: {+ rgb: 'rgb(255,130,0)',+ },+ },+ },+ {+ st: 17,+ ed: 18,+ ts: {+ fs: 14,+ bg: {+ rgb: 'rgb(2,128,2)',+ },+ cl: {+ rgb: 'rgb(0,1,55)',+ },+ va: BaselineOffset.SUPERSCRIPT,},},+ {+ st: 19,+ ed: 60,+ ts: {+ fs: 14,+ bg: {+ rgb: 'rgb(90,128,255)',+ },+ cl: {+ rgb: 'rgb(0,1,255)',+ },+ },+ },+ ],+ paragraphs: [+ {+ startIndex: 60,+ bullet: {+ listId: 'testBullet',+ nestingLevel: 0,+ textStyle: {+ fs: 20,+ },+ },+ },+ ],+ sectionBreaks: [+ {+ startIndex: 61,+ columnProperties: [+ {+ width: 200,+ paddingEnd: 20,+ },+ ],+ columnSeparatorType: ColumnSeparatorType.NONE,+ sectionType: SectionType.SECTION_TYPE_UNSPECIFIED,+ // textDirection: textDirectionDocument,+ // contentDirection: textDirection!,+ },],},documentStyle: {diff --git a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO.ts b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO.tsindex dbd85e87e8..d3fc13f1f6 100644--- a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO.ts+++ b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO.ts@@ -41,7 +41,7 @@ const richTextDemo: IDocumentData = {const richTextDemo1: IDocumentData = {id: 'd',body: {- dataStream: `No.2824163`,+ dataStream: `No.2824163\r\n`,textRuns: [{st: 0,diff --git a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO4.ts b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO4.tsindex e3d59a9f01..aac4c08a0d 100644--- a/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO4.ts+++ b/packages/common-plugin-data/src/Sheets/Demo/DEFAULT_WORKBOOK_DATA_DEMO4.ts@@ -3,7 +3,7 @@ import { BooleanNumber, BorderStyleTypes, IDocumentData, IWorkbookConfig, Localeconst richTextDemo1: IDocumentData = {id: 'd',body: {- dataStream: `No.2824163`,+ dataStream: `No.2824163\r\n`,textRuns: [{st: 0,diff --git a/packages/core/src/Shared/ObjectMatrix.ts b/packages/core/src/Shared/ObjectMatrix.tsindex 00dea32a2e..199b301b7d 100644--- a/packages/core/src/Shared/ObjectMatrix.ts+++ b/packages/core/src/Shared/ObjectMatrix.ts@@ -24,8 +24,7 @@ export class ObjectMatrix<T> {private _matrix: ObjectMatrixPrimitiveType<T>;constructor(matrix: ObjectMatrixPrimitiveType<T> = {}) {- this._matrix = matrix;- this._option = new ObjectArray<ObjectArrayPrimitiveType<T>>(matrix);+ this._setOriginValue(matrix);}static MakeObjectMatrixSize<T>(size: number): ObjectMatrix<T> {@@ -97,7 +96,7 @@ export class ObjectMatrix<T> {}reset() {- this._matrix = {};+ this._setOriginValue({});}hasValue() {@@ -312,4 +311,9 @@ export class ObjectMatrix<T> {endColumn,};}++ private _setOriginValue(matrix: ObjectMatrixPrimitiveType<T> = {}) {+ this._matrix = matrix;+ this._option = new ObjectArray<ObjectArrayPrimitiveType<T>>(matrix);+ }}