Set Height to Document Container to view full document when using Web layout (Continuous)

Hi,

I'm using the Document Editor as a viewer to display as read-only previously saved document.

I'm setting the control as:

<SfDocumentEditorContainer @ref="container" Height="600px" LayoutType="LayoutType.Continuous" EnableToolbar=false ShowPropertiesPane="false" ToolbarItems="@ItemsEmpty" RestrictEditing="true">

    <DocumentEditorContainerEvents Created="OnCreated" >

    </DocumentEditorContainerEvents>

</SfDocumentEditorContainer>


In the OnCreated method I load the content of the document.

If I set Height="100%", it sets the height to 100% of the view port, not the document content.

I want to set the Height of the container to the full length of the document and avoid any scrollbars appearing.

Is this possible?

Regards,



3 Replies

SM Sam Mendes December 14, 2022 10:38 AM UTC

Hi,

I'm trying to do something similar to this but in Blazor:

https://www.syncfusion.com/forums/171302/load-sfdt-content-from-documenteditor-in-the-richtexteditor


Is it possible?


Regards,




DS Dhanush Sekar Syncfusion Team December 15, 2022 07:18 AM UTC

Hi Sam,


We regret to inform you that setting the height to the full length of a document to avoid a scroll bar is not possible.



Regards,

Dhanush Sekar



SM Sam Mendes December 19, 2022 03:20 AM UTC

Hi Dhanush,


I've found a workaround using DocIO. Opening the sfdt content into a Word document and then saving it to Html.


Sample code:

var doc = WordDocument.Save(sfdt);

using (MemoryStream ms = new MemoryStream())

{

doc.Save(ms, Syncfusion.DocIO.FormatType.Html);

return(System.Text.ASCIIEncoding.ASCII.GetString(ms.ToArray()));

}


Then you can render the resulting Html using MarkupString.


Hope this helps to anyone looking for something similar.


You can now close this thread.


Regards,





Loader.
Up arrow icon