String To DocumentAdv
Hi everybody,
I really need your help: I have a SQL Database where I save comments in a varchar field.
Now I'd like to convert the string which will be formated in HTML to a DocumentAdv. I couldn't find a way to do that.
Do you have a solution for me?
Thank you very much :-)
Victor
SIGN IN To post a reply.
5 Replies
PS
Premkumar Sundaramoorthy
Syncfusion Team
March 18, 2020 08:47 AM UTC
Hi Victor,
Thank you for contacting Syncfusion support.
We have created a sample to demonstrate how to load HTML string into SfRichTextBoxAdv control. which can be downloaded from the following link.
https://www.syncfusion.com/downloads/support/forum/152499/ze/RTE_Html_String577536654
Also, you can refer how to implement HtmlText property for SfRichTextBoxAdv Control using the MVVM pattern.
https://www.syncfusion.com/kb/5415/how-to-implement-htmltext-property-for-sfrichtextboxadv-control
https://www.syncfusion.com/kb/6233/how-to-bind-sfrichtextboxadv-contents-using-mvvm-framework
Please let us know if you have any other questions.
Regards,
Premkumar
Thank you for contacting Syncfusion support.
We have created a sample to demonstrate how to load HTML string into SfRichTextBoxAdv control. which can be downloaded from the following link.
https://www.syncfusion.com/downloads/support/forum/152499/ze/RTE_Html_String577536654
Also, you can refer how to implement HtmlText property for SfRichTextBoxAdv Control using the MVVM pattern.
https://www.syncfusion.com/kb/5415/how-to-implement-htmltext-property-for-sfrichtextboxadv-control
https://www.syncfusion.com/kb/6233/how-to-bind-sfrichtextboxadv-contents-using-mvvm-framework
Please let us know if you have any other questions.
Regards,
Premkumar
VD
Victor Dienstbier
March 18, 2020 01:23 PM UTC
Hi!
Thank you very much for your help!
I have done this already - what I actually need is something like this:
DocumentAdv doc = new DocumentAdv();
doc.LoadHTML(html);
Is this possible?
Thank you very much!
Victor
PS
Premkumar Sundaramoorthy
Syncfusion Team
March 19, 2020 06:22 AM UTC
Hi Victor,
Thanks for your update,
As per the current SfRichTextBoxAdv architecture we don’t allow loading document directly to DocumentAdv. We allow loading documents through SfRichTextBoxAdv control alone. Could you please explain to us your end requirement that why you need this API and what you are trying to achieve through this API. Because, if we know your complete requirement, we will try to provide a solution in another way too if it is possible.
please let us know if you have any other questions.
Regards,
Thanks for your update,
As per the current SfRichTextBoxAdv architecture we don’t allow loading document directly to DocumentAdv. We allow loading documents through SfRichTextBoxAdv control alone. Could you please explain to us your end requirement that why you need this API and what you are trying to achieve through this API. Because, if we know your complete requirement, we will try to provide a solution in another way too if it is possible.
please let us know if you have any other questions.
Regards,
Premkumar
VD
Victor Dienstbier
March 19, 2020 02:41 PM UTC
Hi!
I want to do the following:
I have a class like this (just an example):
public class UserItem : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged(string propertyName)
{
var handler = PropertyChanged;
if (handler != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
private string _UserName;
private string _ComputerName;
private string _eMailAddress;
private DocumentAdv _Doc;
public string UserName
{
get { return _UserName; }
set
{
_UserName = value;
OnPropertyChanged("UserName");
}
}
public string ComputerName
{
get { return _ComputerName; }
set
{
_ComputerName = value;
OnPropertyChanged("ComputerName");
}
}
public string eMailAddress
{
get { return _eMailAddress; }
set
{
_eMailAddress = value;
OnPropertyChanged("eMailAddress");
}
}
public DocumentAdv Doc
{
get { return _Doc; }
set
{
_Doc= value;
OnPropertyChanged("Doc");
}
}
}
This I'd like to bind in a ViewModel to the SfRichTextBoxAdv.
Something like:
<ComboBox ItemSource={Binding AllUsers}>
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBox Text={Binding UserName} />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<syncfusion:SfRichTextBoxAdv x:Name="rtbComments"
Height="300"
LayoutType="Continuous"
EnableMiniToolBar="False"
Document="{Binding SelectedUser.Doc}"/>
Now without using CodeBehind I'd like to change the Document if I select a different User.
I hope you now get what I'd like to accieve :-)
Thank you very much!
Victor
PS
Premkumar Sundaramoorthy
Syncfusion Team
March 20, 2020 03:55 PM UTC
Hi Victor,
Thank you for your update.
On further analysis, we found your requirement is you have a set of user details as HTML in the database and you want to show that information in the rich text editor and it should be changed accordingly while selecting the different username in Combobox. But it is not the best way to maintain the user details as DocumentAdv collection instead of a string. Because it took memory than a string so your application size is also getting increased and update the changes to the database from DocumentAdv is also a difficult one.
So, the better way to achieve this is by implementing HtmlText property in the SfRichTextBoxAdv extension class using the MVVM pattern. Because here you no need to maintain any data collection and you can get the data directly from the database and update changes to database if any changes take place.
Also, we have created a sample to demonstrate the same. Which can be downloaded from the following location.
https://www.syncfusion.com/downloads/support/forum/152499/ze/MVVM_Html_Modified2052736414
Please let us know if you need any further assistance.
Regards,
Premkumar
Thank you for your update.
On further analysis, we found your requirement is you have a set of user details as HTML in the database and you want to show that information in the rich text editor and it should be changed accordingly while selecting the different username in Combobox. But it is not the best way to maintain the user details as DocumentAdv collection instead of a string. Because it took memory than a string so your application size is also getting increased and update the changes to the database from DocumentAdv is also a difficult one.
So, the better way to achieve this is by implementing HtmlText property in the SfRichTextBoxAdv extension class using the MVVM pattern. Because here you no need to maintain any data collection and you can get the data directly from the database and update changes to database if any changes take place.
Also, we have created a sample to demonstrate the same. Which can be downloaded from the following location.
https://www.syncfusion.com/downloads/support/forum/152499/ze/MVVM_Html_Modified2052736414
Please let us know if you need any further assistance.
Regards,
Premkumar
SIGN IN To post a reply.
- 5 Replies
- 2 Participants
-
VD Victor Dienstbier
- Mar 17, 2020 03:04 PM UTC
- Mar 20, 2020 03:55 PM UTC