How to Disable Optimized Text Measuring in TypeScript DOCX Editor
28 Aug 20261 minute to read
Starting from v19.3.0.x, the accuracy of text size measurements in TypeScript DOCX Editor (Document Editor) is improved to better match Microsoft Word pagination for most Word documents. This improvement is included as the default behavior along with an optional API enableOptimizedTextMeasuring in the Document Editor settings.
If you want the DOCX Editor component to retain the document pagination (display page-by-page) behavior like v19.2.0.x and older versions, then you can disable this optimized text measuring improvement by setting the enableOptimizedTextMeasuring property of the JavaScript DOCX Editor component to false.
Disable optimized text measuring in a DocumentEditorContainer instance
The following example code illustrates how to disable the optimized text measuring improvement in a DocumentEditorContainer instance.
import { DocumentEditorContainer, Toolbar } from '@syncfusion/ej2-documenteditor';
DocumentEditorContainer.Inject(Toolbar);
let container: DocumentEditorContainer = new DocumentEditorContainer({ enableToolbar: true, height: '590px' });
// Disable optimized text measuring improvement
container.documentEditorSettings = { enableOptimizedTextMeasuring: false };
container.serviceUrl = 'https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/';
container.appendTo('#container');Disable optimized text measuring in a DocumentEditor instance
The following example code illustrates how to disable the optimized text measuring improvement in a DocumentEditor instance.
import { DocumentEditor } from '@syncfusion/ej2-documenteditor';
let documentEditor: DocumentEditor = new DocumentEditor({ isReadOnly: false, height: '370px', serviceUrl: 'https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/' });
documentEditor.enableAllModules();
// Disable optimized text measuring improvement
documentEditor.documentEditorSettings = { enableOptimizedTextMeasuring: false };
documentEditor.appendTo('#DocumentEditor');The Web API hosted link
https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/utilized in the DOCX Editor’s serviceUrl property is intended solely for demonstration and evaluation purposes. For production deployment, please host your own web service with your required server configurations. You can refer and reuse the GitHub Web Service example or Docker image for hosting your own web service and use for the serviceUrl property.