| File | Date | Author | Commit |
|---|---|---|---|
| Source | 2020-12-17 |
|
[038ecf] Update about.xml |
| about.files | 2020-12-17 |
|
[1779e4] Update dcimg_39230.jpg |
| .gitignore | 2020-12-15 |
|
[d19614] preview-2020-12-15 |
| LICENSE | 2020-12-10 |
|
[53d972] Initial commit |
| README.md | 2020-12-17 |
|
[bd2e72] Update README.md |
| about.htm | 2020-12-17 |
|
[280793] update about.html |
| snapshort.png | 2020-12-17 |
|
[d1af9f] Update snapshort.png |

Many people use standard RichTextBox control to handle RTF style text . but RichTextBox control has lots limited. for example ,It can not use in NO-GUI application,RTF file format is hard to parse, hard to change party of document content by programming.
CSharpWriter(short name CSWriter) is a new RTF style document process engine without RichTextBox control. it is more powerfull than RichTextBox.We holpe it can replace OpenOffice in .NET World.It support :
Just like others winform control.you can use CSWriter easy. in VS.NET IDE,open winform designer,at toolbox left side,choose "choose items..." . and select file DCSoft.CSharpWriter.dll ,than you can see CSWriterControl on toolbox,just like the following:

You can drag a CSWriterControl and a CSWriterCommandControler to the form ,change it's name as 'myEditControl' and 'myCommandControler'.
Next you can add some button/toolstripbutton or menu item on the form,select a button ,at PropertyGrid,you can see a property item name "at myCommandControler's CommandName",Just like the following:

click button at the end,then show a dialog like this:

And you can select a command whitch binding to the button.Then you design a form like this:

Open the source editor, At the form_load event source code,add the following code:
private void frmTextUseCommand_Load(object sender, EventArgs e)
{
myEditControl.CommandControler = myCommandControler;
myCommandControler.Start();
}
After do this,you can run application ,click button or menu item to use CSWriter. look ,it is so easy.
CSWriter support a lot of commands.You can open a file by code myEditControl.ExecuteCommand("FileOpen", true, null), save a file by code myEditControl.ExecuteCommand("FileSaveAs", true,null) , Inser a string at current position by code myEditControl.ExecuteCommand("InsertString",false,"Some text content") .
Those commands defind in WriterCommandModuleBrowse.cs, WriterCommandModuleEdit.cs,WriterCommandModuleFile.cs, WriterCommandModuleFormat.cs, WriterCommandModuleInsert.cs, WriterCommandModuleSecurity.cs, WriterCommandModuleTools.cs in directory "CSharpWriter\Commands".You can add your owner command in those files.For example,this code define command "InsertString":
[WriterCommandDescription("InsertString")]
protected void InsertString(object sender, WriterCommandEventArgs args)
{
if (args.Mode == WriterCommandEventMode.QueryState)
{
args.Enabled = args.DocumentControler != null
&& args.DocumentControler.CanInsertElementAtCurrentPosition(
typeof(DomCharElement));
}
else if (args.Mode == WriterCommandEventMode.Invoke)
{
args.Result = 0;
InsertStringCommandParameter parameter = null;
if (args.Parameter is InsertStringCommandParameter)
{
parameter = (InsertStringCommandParameter)args.Parameter;
}
else
{
parameter = new InsertStringCommandParameter();
if (args.Parameter != null)
{
parameter.Text = Convert.ToString(args.Parameter);
}
}
if (args.ShowUI)
{
using (dlgInputString dlg = new dlgInputString())
{
dlg.InputText = parameter.Text;
if (dlg.ShowDialog(args.EditorControl) == DialogResult.OK)
{
parameter.Text = dlg.InputText;
}
else
{
return;
}
}
}
if (string.IsNullOrEmpty(parameter.Text) == false)
{
args.Result = args.DocumentControler.InsertString(parameter.Text);
}
}
}
In thess code, the "QueryState" party is detect wheather the command is Enable currenttly.System will call this party to set Button/MenuItem.Enable =true or false. the "Invoke"party is define the body of command.
Currenttly, CSWriter save load or save XML file format.In the futury , it will support RTF , HTML(MHT),PDF,BMP , ODF(Open doucument format) file format.and you can add your owner file format.
CSWriter is a lite GUI Control component.All part include in single file"DCSoft.CSharpWriter.dll".independent any third part component.It run on MS.NET framework 2.0 SP2 or later. Notice , Must add SP2.becase CSWriterControl use property "CanEnableIme" which define in SP2(no defind in .NET2.0 without SP2).
When you need update CSWriter, overwrite dll file , and re-compile your source code and finished.
CSWriter provide technology support.If you have some question or idea, you can write email [28348092@qq.com] or [yyf9989@hotmail.com] , or visit site[https://github.com/dcsoft-yyf/CSharpWriter].
In this version, the with of whitespace is too small,In the futrue , the wdith of whitespace maby increase,this will change doucment layout.
This is the route map:

The core of CSWriter. Dom description any details of document. every part of document has map to a class instance. programmer can new or delete Dom elements ,modify element''s property ,those can update document view ,just like JavaScript update HTML view by modify HTML DOM. DOM also is expendable,in the future ,it will add new type element class ,support new behavior. create an unlimited cswriter.
This is element implement tree in DOM:

DOM define a set of classes,just like HTML DOM,each type of class map to a type content in document.for example, DomDocument class map to the total document, It is the primary enterpoint for programming; DomImageElement map to a image in document,DomCharElement map to a character in document.
This is DOM element reference tree:

CSWriter build a DOM tree in memory,every document element instance placed in the tree.[Document] is the single enterpoint to access DOM tree.You can insert/delete element in the tree,and the system can update view quickly.just like javascript access HTMLDom.
CSWriter use LGPL-2.1 License.If you want to change License type and use it in business unlimited,you can cantact me private.