Home > Net >  Want to use c # to do a similar to know simple HTML document editor of the note
Want to use c # to do a similar to know simple HTML document editor of the note

Time:10-05

What need to prepare what things? Function is relatively simple, toolbar, and to be able to set the font, size, color, plus insert images about the same, so use c # to do, what knowledge need to prepare?
The difficulty here is that how to implement the Html document edit? Webbrowser control as if does not support the editor (I thought every time the players try to edit, use of third-party libraries HtmlAgilityPack HtmlDocument offers classes to parse and update the Html document, and then reload, but don't know how to specific implementation, and feeling rather sick ~); And if it's not an Html document, but with the general RichTextBox to rich text editor, because I thought the document form or like Html tags based, so want to do some custom tags in order to realize more functions (such as the default Chinese fonts, default font, in English on content tag, etc.), and use this kind of control can't seem to meet the requirements of me,

CodePudding user response:

Can use third-party libraries such as UEditor,

Pure client can show your support by WPF, like HTML, there are examples can be very similar to the Word, you look for on the net,

VSCODE open source, are interested can go to read,

CodePudding user response:

reference 1st floor assky124 response:
can use third-party libraries such as UEditor,

Pure client can show your support by WPF, like HTML, there are examples can be very similar to the Word, you look for on the net,

VSCODE open source, are interested can go to read,

Last night to check for a long time, seems to be more flexible and simple way is the WPF + MSHTML, but don't know if I can really meet the requirements of I,

CodePudding user response:

HTML USES UEditor, or other third party rich text editor
WP and WPF Richtextbox
Or WebOffice

CodePudding user response:

reference 3 floor XBodhi. Response:
HTML with UEditor, or other third party rich text editor
WP and WPF Richtextbox
Or WebOffice

UEditor is open source, seems to be good, but seems not support language c #, kindeditor support for c #, but does not support changes,

CodePudding user response:

That supports editing a
Webbrowser1. DocumentText=string. The Empty;
Webbrowser1. Document. ExecCommand (EditMode, false, null);
Webbrowser1. Document. ExecCommand (" LiveResize ", false, null);

Such as text bold
Webbrowser1. Document. ExecCommand (" Bold ", false, null);

CodePudding user response:

reference harry _ spider-man 4 floor response:
Quote: reference 3 floor XBodhi. Response:

HTML USES UEditor, or other third party rich text editor
WP and WPF Richtextbox
Or WebOffice

UEditor is open source, seems to be good, but seems not support language c #, kindeditor support for c #, but does not support changes,



You can baidu, indeed, he is JS, you can baidu has support for c #

CodePudding user response:

reference 5 floor asq985 reply:
webbrowser supports editing
Webbrowser1. DocumentText=string. The Empty;
Webbrowser1. Document. ExecCommand (EditMode, false, null);
Webbrowser1. Document. ExecCommand (" LiveResize ", false, null);

Such as text bold
Webbrowser1. Document. ExecCommand (" Bold ", false, null);

Do not know do not allow the custom tag, also want to know where I can get a webbrowser comparison entry-level user manual, such as online search is messy,

CodePudding user response:

refer to 7th floor harry _ spider-man's reply:
Quote: refer to the fifth floor asq985 reply:

That supports editing a
Webbrowser1. DocumentText=string. The Empty;
Webbrowser1. Document. ExecCommand (EditMode, false, null);
Webbrowser1. Document. ExecCommand (" LiveResize ", false, null);

Such as text bold
Webbrowser1. Document. ExecCommand (" Bold ", false, null);

Do not know do not allow the custom tag, also want to know where I can get a webbrowser comparison entry-level user manual, such as online search is messy,

Of course, the basic function can realize the HTML editor, is not a special requirement, can satisfy the need of editing

Such as insert a picture:

C=new insertImagesForms insertImagesForms ();
If (c.s. howDialog ()==DialogResult. OK & amp; & ! String. IsNullOrEmpty (c.p icture))
{
IHTMLDocument2 doc=(IHTMLDocument2) this. W1. Document. The DomDocument;
IHTMLTxtRange range=doc. Selection. CreateRange () as IHTMLTxtRange;
Range. PasteHTML (@ c.p icture);
}


CodePudding user response:

refer to the eighth floor asq985 response:
of course, the basic function can realize the HTML editor, is not a special requirement, can satisfy the need of editing

Such as insert a picture:

C=new insertImagesForms insertImagesForms ();
If (c.s. howDialog ()==DialogResult. OK & amp; & ! String. IsNullOrEmpty (c.p icture))
{
IHTMLDocument2 doc=(IHTMLDocument2) this. W1. Document. The DomDocument;
IHTMLTxtRange range=doc. Selection. CreateRange () as IHTMLTxtRange;
Range. PasteHTML (@ c.p icture);
}


Research and more and more confused, and now there are two problems:
The first is that the command
 
Webbrowser1. Document. ExecCommand (EditMode, false, null);

What is the reverse order? How can we withdraw from the edit mode is the call?
Why in the official Document, the second is that I want to see the Document. The ExecCommand () the first parameter to the to take those values, it is give me a list of some of the enumeration values, rather than a string?

Finally, there can find a more detailed primary webbrowser instructions? I will now only some basic c # syntax, and will use some simple controls,

CodePudding user response:

references 9 f harry _ spider-man's reply:
Quote: refer to the eighth floor asq985 response:

Of course, the basic function can realize the HTML editor, is not a special requirement, can satisfy the need of editing

Such as insert a picture:

C=new insertImagesForms insertImagesForms ();
If (c.s. howDialog ()==DialogResult. OK & amp; & ! String. IsNullOrEmpty (c.p icture))
{
IHTMLDocument2 doc=(IHTMLDocument2) this. W1. Document. The DomDocument;
IHTMLTxtRange range=doc. Selection. CreateRange () as IHTMLTxtRange;
Range. PasteHTML (@ c.p icture);
}


Research and more and more confused, and now there are two problems:
The first is that the command
nullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnullnull
  •  Tags:  
  • C #
  • Related