How to set font size and line spacing after loading content

I have tried as follows,The last line wants to cancel the selection, but the cursor cannot be positioned at the end of the document.


Is there any other solution to set font size and line spacing after loading content?

Looking forward to your reply.


      const documentEditor =
        this.$refs.doceditcontainer.ej2Instances.documentEditor;
      documentEditor.open(wordData);
      documentEditor.selection.selectAll();
      documentEditor.selection.characterFormat.fontSize = 20;
      documentEditor.selection.paragraphFormat.lineSpacing = 3;
      documentEditor.selection.select({ x: 0, y: 0 });




3 Replies 1 reply marked as answer

SK Selvaprakash Karuppusamy Syncfusion Team July 7, 2023 06:56 AM UTC

Hi bingxueyinlian,


Please refer to the below UG documentation to know how to set the default format. 

UG: https://ej2.syncfusion.com/vue/documentation/document-editor/how-to/set-default-format-in-document-editor 


Regards,

Selvaprakash K



BI bingxueyinlian replied to Selvaprakash Karuppusamy July 7, 2023 07:07 AM UTC

I have seen the default format. But the opened content contains formatting, so the default formatting will not take effect.

Because the font and spacing of the original saved file are too small, I hope to set it uniformly when displaying to make the content display clearer





SK Selvaprakash Karuppusamy Syncfusion Team July 11, 2023 07:15 AM UTC

Hi bingxueyinlian,


You already shared code that is the solution to changing formats after loading the document content, and you can select elements based on the start and end hierarchical indexes, and we have APIs to move the selection, so you can change the selection based on that. Please refer to the below UG documentation.

https://ej2.syncfusion.com/vue/documentation/document-editor/how-to/move-selection-to-specific-position#selects-content-based-on-start-and-end-hierarchical-index

https://ej2.syncfusion.com/vue/documentation/api/document-editor/selection/#movetodocumentend


Marked as answer
Loader.
Up arrow icon