Skip to content

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.

feat: set document (#3521)

Ran Luo5489ce8cda2d
diff --git a/packages/docs-ui/src/services/editor/editor.ts b/packages/docs-ui/src/services/editor/editor.ts
index 10a364b09c..607fc41493 100644
--- a/packages/docs-ui/src/services/editor/editor.ts
+++ b/packages/docs-ui/src/services/editor/editor.ts
@@ -330,7 +330,12 @@ export class Editor extends Disposable implements IEditor {
this._commandService.executeCommand(ReplaceContentCommand.id, {
unitId: id,
- body,
+ body: {
+ ...body,
+ dataStream: body?.dataStream.endsWith('\r\n')
+ ? body.dataStream.substring(0, body.dataStream.length - 2)
+ : body!.dataStream,
+ },
textRanges,
});
}