View in React Document Editor Component
1 Jul 20268 minutes to read
Web Layout
React DOCX Editor (Document Editor) Container component allows you to change the view to web layout and print using the layoutType property with the supported LayoutType.
<DocumentEditorContainerComponent id="container" layoutType={'Continuous'} enableToolbar={true}/>
Note: Default value of
layoutTypein Document Editor Container component isPages.
Online Demo
Explore how to view Word documents in web layout using the React Document Editor in this live demo here.
Ruler
Using ruler we can refer to setting specific margins, tab stops, or indentations within a document to ensure consistent formatting in Document Editor.
The following example illustrates how to enable ruler in Document Editor
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { DocumentEditorComponent, Editor, Selection } from '@syncfusion/ej2-react-documenteditor';
DocumentEditorComponent.Inject(Editor, Selection);
function App() {
let container;
React.useEffect(() => {
componentDidMount()
}, []);
function created() {
container.documentEditorSettings.showRuler = true;
}
function componentDidMount() {
setTimeout(() => {
created();
});
}
function onClick() {
container.documentEditorSettings.showRuler = !container.documentEditorSettings.showRuler;
}
return (<div>
<button id='container_ruler_button' onClick={onClick}>Show/Hide Ruler</button>
<DocumentEditorComponent id="container" height={'590px'} isReadOnly={false} ref={(scope) => {
container = scope;
created();
}} enableEditor={true} enableSelection={true}
serviceUrl="https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/"
/>
</div>
);
}
export default App;
ReactDOM.render(<App />, document.getElementById('root'));import * as ReactDOM from 'react-dom';
import * as React from 'react';
import { DocumentEditorComponent, Editor, Selection } from '@syncfusion/ej2-react-documenteditor';
DocumentEditorComponent.Inject(Editor, Selection);
function App() {
let container: DocumentEditorComponent;
React.useEffect(() => {
componentDidMount()
}, []);
function created() {
container.documentEditorSettings.showRuler = true;
}
function componentDidMount() {
setTimeout(() => {
created();
});
}
function onClick() {
container.documentEditorSettings.showRuler = !container.documentEditorSettings.showRuler;
}
return ( <div>
<button id='container_ruler_button' onClick={onClick}>Show/Hide Ruler</button>
<DocumentEditorComponent id="container" height={'590px'} isReadOnly={false} ref={(scope) => {
container = scope;
created();
}} enableEditor={true} enableSelection={true}
serviceUrl="https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/"
/>
</div>
);
}
export default App;
ReactDOM.render(<App />, document.getElementById('root'));<!DOCTYPE html>
<html lang="en">
<head>
<title>Syncfusion React Button</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<meta name="description" content="Essential JS 2 for React Components" />
<meta name="author" content="Syncfusion" />
<link href="index.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.1.44/ej2-react-documenteditor/styles/fabric.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.1.44/ej2-documenteditor/styles/fabric.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.1.44/ej2-buttons/styles/fabric.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.1.44/ej2-base/styles/fabric.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.1.44/ej2-dropdowns/styles/fabric.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.1.44/ej2-inputs/styles/fabric.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.1.44/ej2-splitbuttons/styles/fabric.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.1.44/ej2-lists/styles/fabric.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.1.44/ej2-navigations/styles/fabric.css" rel="stylesheet" />
<link href="https://cdn.syncfusion.com/ej2/33.1.44/ej2-popups/styles/fabric.css" rel="stylesheet" />
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/systemjs/0.19.38/system.js"></script>
<script src="systemjs.config.js"></script>
<script src="https://cdn.syncfusion.com/ej2/syncfusion-helper.js" type ="text/javascript"></script>
</head>
<body>
<div id='root'>
<div id='loader'>Loading....</div>
</div>
</body>
</html>The Web API hosted link
https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/utilized in the Document 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.
Online Demo
Explore how to use the ruler in the React Document Editor for working with Word documents in this live demo here.
Heading Navigation Pane
Using the heading navigation pane allows users to swiftly navigate documents by heading, enhancing their ability to move through the document efficiently.
The following example demonstrates how to enable the heading navigation pane in a document editor.
import * as ReactDOM from 'react-dom';
import * as React from 'react';
import {
DocumentEditorContainerComponent,
Toolbar,
} from '@syncfusion/ej2-react-documenteditor';
DocumentEditorContainerComponent.Inject(Toolbar);
function App() {
let settings = {showNavigationPane: true};
return (
<DocumentEditorContainerComponent
id="container"
height={'590px'}
serviceUrl="https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/"
enableToolbar={true}
documentEditorSettings={settings}
/>
);
}
export default App;
ReactDOM.render(<App />, document.getElementById('root'));The Web API hosted link
https://document.syncfusion.com/web-services/docx-editor/api/documenteditor/utilized in the Document 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.
Online Demo
Explore how to navigate through headings in Word documents using the React Document Editor in this live demo here.