├── .github └── FUNDING.yml ├── .gitignore ├── Documentation ├── Word_2002_RTF_Specification_Final.doc └── original-readme.rtf ├── LICENSE ├── README.md ├── Source ├── RtfDomParser.Tests │ ├── Helper.cs │ ├── Properties │ │ └── AssemblyInfo.cs │ ├── RtfDomParser.Tests.csproj │ ├── RtfTest.cs │ └── packages.config ├── RtfDomParser.WinFormsDemo │ ├── Program.cs │ ├── RTFDemo │ │ ├── Blank.rtf │ │ ├── Complex table.rtf │ │ ├── Formated text.rtf │ │ ├── Images.rtf │ │ ├── NestTable.rtf │ │ ├── Simple table.rtf │ │ ├── Simple text.rtf │ │ ├── Text box.rtf │ │ ├── Three layer nested table.rtf │ │ ├── htmlrtf1.rtf │ │ ├── htmlrtf2.rtf │ │ └── htmlrtf3.rtf │ ├── RtfDomParser.WinFormsDemo.csproj │ ├── frmRTFTest.Designer.cs │ ├── frmRTFTest.cs │ ├── frmRTFTest.en.resx │ └── frmRTFTest.resx ├── RtfDomParser.sln └── RtfDomParser │ ├── ByteBuffer.cs │ ├── Defaults.cs │ ├── DocumentFormatInfo.cs │ ├── LevelNumberType.cs │ ├── Parser.cs │ ├── ProgressEventHandler.cs │ ├── Properties │ └── AssemblyInfo.cs │ ├── RTFAlignment.cs │ ├── RTFAttribute.cs │ ├── RTFBorderStyle.cs │ ├── RTFColorTable.cs │ ├── RTFConsts.cs │ ├── RTFDocumentInfo.cs │ ├── RTFDocumentWriter.cs │ ├── RTFDomBookmark.cs │ ├── RTFDomDocument.cs │ ├── RTFDomElement.cs │ ├── RTFDomElementContainer.cs │ ├── RTFDomElementList.cs │ ├── RTFDomField.cs │ ├── RTFDomHeader.cs │ ├── RTFDomImage.cs │ ├── RTFDomLineBreak.cs │ ├── RTFDomObject.cs │ ├── RTFDomPageBreak.cs │ ├── RTFDomParagraph.cs │ ├── RTFDomShape.cs │ ├── RTFDomShapeGroup.cs │ ├── RTFDomTable.cs │ ├── RTFDomTableCell.cs │ ├── RTFDomTableColumn.cs │ ├── RTFDomTableRow.cs │ ├── RTFDomTempContainer.cs │ ├── RTFDomText.cs │ ├── RTFFontTable.cs │ ├── RTFInstanceDebugView.cs │ ├── RTFListOverrideTable.cs │ ├── RTFListTable.cs │ ├── RTFNode.cs │ ├── RTFNodeGroup.cs │ ├── RTFNodeList.cs │ ├── RTFNodeType.cs │ ├── RTFRawDocument.cs │ ├── RTFRawLayerInfo.cs │ ├── RTFUtil.cs │ ├── RTFVerticalAlignment.cs │ ├── RTFWriter.cs │ ├── RtfDomParser.csproj │ ├── StringAttribute.cs │ └── yyf.snk └── appveyor.yml /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | github: NikolayIT # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 4 | patreon: # Replace with a single Patreon username 5 | open_collective: # Replace with a single Open Collective username 6 | ko_fi: # Replace with a single Ko-fi username 7 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 8 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 9 | liberapay: # Replace with a single Liberapay username 10 | issuehunt: # Replace with a single IssueHunt username 11 | otechie: # Replace with a single Otechie username 12 | custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2'] 13 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ## Ignore Visual Studio temporary files, build results, and 2 | ## files generated by popular Visual Studio add-ons. 3 | 4 | # User-specific files 5 | *.suo 6 | *.user 7 | *.userosscache 8 | *.sln.docstates 9 | 10 | # User-specific files (MonoDevelop/Xamarin Studio) 11 | *.userprefs 12 | 13 | # Build results 14 | [Dd]ebug/ 15 | [Dd]ebugPublic/ 16 | [Rr]elease/ 17 | [Rr]eleases/ 18 | x64/ 19 | x86/ 20 | build/ 21 | bld/ 22 | [Bb]in/ 23 | [Oo]bj/ 24 | 25 | # Visual Studo 2015 cache/options directory 26 | .vs/ 27 | 28 | # MSTest test Results 29 | [Tt]est[Rr]esult*/ 30 | [Bb]uild[Ll]og.* 31 | 32 | # NUNIT 33 | *.VisualState.xml 34 | TestResult.xml 35 | 36 | # Build Results of an ATL Project 37 | [Dd]ebugPS/ 38 | [Rr]eleasePS/ 39 | dlldata.c 40 | 41 | *_i.c 42 | *_p.c 43 | *_i.h 44 | *.ilk 45 | *.meta 46 | *.obj 47 | *.pch 48 | *.pdb 49 | *.pgc 50 | *.pgd 51 | *.rsp 52 | *.sbr 53 | *.tlb 54 | *.tli 55 | *.tlh 56 | *.tmp 57 | *.tmp_proj 58 | *.log 59 | *.vspscc 60 | *.vssscc 61 | .builds 62 | *.pidb 63 | *.svclog 64 | *.scc 65 | 66 | # Chutzpah Test files 67 | _Chutzpah* 68 | 69 | # Visual C++ cache files 70 | ipch/ 71 | *.aps 72 | *.ncb 73 | *.opensdf 74 | *.sdf 75 | *.cachefile 76 | 77 | # Visual Studio profiler 78 | *.psess 79 | *.vsp 80 | *.vspx 81 | 82 | # TFS 2012 Local Workspace 83 | $tf/ 84 | 85 | # Guidance Automation Toolkit 86 | *.gpState 87 | 88 | # ReSharper is a .NET coding add-in 89 | _ReSharper*/ 90 | *.[Rr]e[Ss]harper 91 | *.DotSettings.user 92 | 93 | # JustCode is a .NET coding addin-in 94 | .JustCode 95 | 96 | # TeamCity is a build add-in 97 | _TeamCity* 98 | 99 | # DotCover is a Code Coverage Tool 100 | *.dotCover 101 | 102 | # NCrunch 103 | _NCrunch_* 104 | .*crunch*.local.xml 105 | 106 | # MightyMoose 107 | *.mm.* 108 | AutoTest.Net/ 109 | 110 | # Web workbench (sass) 111 | .sass-cache/ 112 | 113 | # Installshield output folder 114 | [Ee]xpress/ 115 | 116 | # DocProject is a documentation generator add-in 117 | DocProject/buildhelp/ 118 | DocProject/Help/*.HxT 119 | DocProject/Help/*.HxC 120 | DocProject/Help/*.hhc 121 | DocProject/Help/*.hhk 122 | DocProject/Help/*.hhp 123 | DocProject/Help/Html2 124 | DocProject/Help/html 125 | 126 | # Click-Once directory 127 | publish/ 128 | 129 | # Publish Web Output 130 | *.[Pp]ublish.xml 131 | *.azurePubxml 132 | # TODO: Comment the next line if you want to checkin your web deploy settings 133 | # but database connection strings (with potential passwords) will be unencrypted 134 | *.pubxml 135 | *.publishproj 136 | 137 | # NuGet Packages 138 | *.nupkg 139 | # The packages folder can be ignored because of Package Restore 140 | **/packages/* 141 | # except build/, which is used as an MSBuild target. 142 | !**/packages/build/ 143 | # Uncomment if necessary however generally it will be regenerated when needed 144 | #!**/packages/repositories.config 145 | 146 | # Windows Azure Build Output 147 | csx/ 148 | *.build.csdef 149 | 150 | # Windows Store app package directory 151 | AppPackages/ 152 | 153 | # Others 154 | *.[Cc]ache 155 | ClientBin/ 156 | [Ss]tyle[Cc]op.* 157 | ~$* 158 | *~ 159 | *.dbmdl 160 | *.dbproj.schemaview 161 | *.pfx 162 | *.publishsettings 163 | node_modules/ 164 | bower_components/ 165 | 166 | # RIA/Silverlight projects 167 | Generated_Code/ 168 | 169 | # Backup & report files from converting an old project file 170 | # to a newer Visual Studio version. Backup files are not needed, 171 | # because we have git ;-) 172 | _UpgradeReport_Files/ 173 | Backup*/ 174 | UpgradeLog*.XML 175 | UpgradeLog*.htm 176 | 177 | # SQL Server files 178 | *.mdf 179 | *.ldf 180 | 181 | # Business Intelligence projects 182 | *.rdl.data 183 | *.bim.layout 184 | *.bim_*.settings 185 | 186 | # Microsoft Fakes 187 | FakesAssemblies/ 188 | 189 | # Node.js Tools for Visual Studio 190 | .ntvs_analysis.dat 191 | 192 | # Visual Studio 6 build log 193 | *.plg 194 | 195 | # Visual Studio 6 workspace options file 196 | *.opt 197 | -------------------------------------------------------------------------------- /Documentation/Word_2002_RTF_Specification_Final.doc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SourceCodeBackup/RtfDomParser/b7277305198a1d88754ee364cfbfdea044ef1ff7/Documentation/Word_2002_RTF_Specification_Final.doc -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Nikolay Kostov 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # RtfDomParser (a.k.a. DCSoft.RTF and XDesigner.RTF) 2 | **RtfDomParser (a.k.a. DCSoft.RTF and XDesigner.RTF)** is an open source C# library for parsing **RTF** documents and generating RTF DOM Tree. 3 | 4 | Initially the project was started by **yuansfu**, last updated on `Apr 6, 2013` and was located on 5 | - http://sourceforge.net/projects/rtfdomparser/ and 6 | - https://rdp.codeplex.com/ 7 | 8 | The development of the project is dead so here I will continue to support the code and will provide NuGet packages for easier installation. 9 | 10 | ## Build 11 | 12 | [![Build status](https://ci.appveyor.com/api/projects/status/ts22h5vdkjej9j25?svg=true)](https://ci.appveyor.com/project/NikolayIT/rtfdomparser) 13 | 14 | **NuGet:** https://www.nuget.org/packages/RtfDomParser/ 15 | 16 | ## Features 17 | * Parse RTF and generate dom tree. 18 | * Support image , table , multi-nested table , textbox , shape , cell merge. 19 | * Can parse huge rtf document more than 100MB. 20 | * Easy to .NET programming. 21 | -------------------------------------------------------------------------------- /Source/RtfDomParser.Tests/Helper.cs: -------------------------------------------------------------------------------- 1 | namespace RtfDomParser.Tests 2 | { 3 | internal static class Helper 4 | { 5 | /// 6 | /// Test to generate a little rtf document 7 | /// 8 | /// RTF text writer 9 | internal static void TestBuildRTF(RTFWriter w) 10 | { 11 | w.Encoding = System.Text.Encoding.GetEncoding(936); 12 | // write header 13 | w.WriteStartGroup(); 14 | w.WriteKeyword("rtf1"); 15 | w.WriteKeyword("ansi"); 16 | w.WriteKeyword("ansicpg" + w.Encoding.CodePage); 17 | // wirte font table 18 | w.WriteStartGroup(); 19 | w.WriteKeyword("fonttbl"); 20 | w.WriteStartGroup(); 21 | w.WriteKeyword("f0"); 22 | w.WriteText("Arial;"); 23 | w.WriteEndGroup(); 24 | w.WriteStartGroup(); 25 | w.WriteKeyword("f1"); 26 | w.WriteText("Times New Roman;"); 27 | w.WriteEndGroup(); 28 | w.WriteEndGroup(); 29 | // write color table 30 | w.WriteStartGroup(); 31 | w.WriteKeyword("colortbl"); 32 | w.WriteText(";"); 33 | w.WriteKeyword("red0"); 34 | w.WriteKeyword("green0"); 35 | w.WriteKeyword("blue255"); 36 | w.WriteText(";"); 37 | w.WriteEndGroup(); 38 | // write content 39 | w.WriteKeyword("qc"); // set alignment center 40 | w.WriteKeyword("f0"); // set font 41 | w.WriteKeyword("fs30"); // set font size 42 | w.WriteText("This is the first paragraph text "); 43 | w.WriteKeyword("cf1"); // set text color 44 | w.WriteText("Arial "); 45 | w.WriteKeyword("cf0"); // set default color 46 | w.WriteKeyword("f1"); // set font 47 | w.WriteText("Align center ABC12345"); 48 | w.WriteKeyword("par"); // new paragraph 49 | w.WriteKeyword("pard"); // clear format 50 | w.WriteKeyword("f1"); // set font 51 | w.WriteKeyword("fs20"); // set font size 52 | w.WriteKeyword("cf1"); 53 | w.WriteText("This is the secend paragraph Arial left alignment ABC12345"); 54 | // finish 55 | w.WriteEndGroup(); 56 | } 57 | } 58 | } -------------------------------------------------------------------------------- /Source/RtfDomParser.Tests/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | // General Information about an assembly is controlled through the following 6 | // set of attributes. Change these attribute values to modify the information 7 | // associated with an assembly. 8 | [assembly: AssemblyTitle("RtfDomParser.Tests")] 9 | [assembly: AssemblyDescription("")] 10 | [assembly: AssemblyConfiguration("")] 11 | [assembly: AssemblyCompany("")] 12 | [assembly: AssemblyProduct("RtfDomParser.Tests")] 13 | [assembly: AssemblyCopyright("Copyright © 2015")] 14 | [assembly: AssemblyTrademark("")] 15 | [assembly: AssemblyCulture("")] 16 | 17 | // Setting ComVisible to false makes the types in this assembly not visible 18 | // to COM components. If you need to access a type in this assembly from 19 | // COM, set the ComVisible attribute to true on that type. 20 | [assembly: ComVisible(false)] 21 | 22 | // The following GUID is for the ID of the typelib if this project is exposed to COM 23 | [assembly: Guid("c2283e51-a105-4ff3-96b4-c77dac45f2e4")] 24 | 25 | // Version information for an assembly consists of the following four values: 26 | // 27 | // Major Version 28 | // Minor Version 29 | // Build Number 30 | // Revision 31 | // 32 | // You can specify all the values or you can default the Build and Revision Numbers 33 | // by using the '*' as shown below: 34 | // [assembly: AssemblyVersion("1.0.*")] 35 | [assembly: AssemblyVersion("1.0.0.0")] 36 | [assembly: AssemblyFileVersion("1.0.0.0")] 37 | -------------------------------------------------------------------------------- /Source/RtfDomParser.Tests/RtfDomParser.Tests.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0-windows 5 | false 6 | true 7 | 8 | false 9 | CA1416 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | all 18 | runtime; build; native; contentfiles; analyzers; buildtransitive 19 | 20 | 21 | all 22 | runtime; build; native; contentfiles; analyzers; buildtransitive 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /Source/RtfDomParser.Tests/RtfTest.cs: -------------------------------------------------------------------------------- 1 | using System.IO; 2 | using System.Threading; 3 | using NUnit.Framework; 4 | 5 | namespace RtfDomParser.Tests 6 | { 7 | [TestFixture] 8 | public class RtfTest 9 | { 10 | [SetUp] 11 | public void Setup() 12 | { 13 | Defaults.FontName = System.Windows.Forms.Control.DefaultFont.Name; 14 | } 15 | 16 | /// 17 | /// Test generate rtf file 18 | /// after execute this function you can open c:\a.rtf 19 | /// 20 | [Test] 21 | public void TestWriteFile() 22 | { 23 | string file = Path.GetFullPath("a.rtf"); 24 | RTFWriter w = new RTFWriter(file); 25 | Helper.TestBuildRTF(w); 26 | w.Close(); 27 | System.Windows.Forms.MessageBox.Show($"OK, you can open file {file} now."); 28 | } 29 | 30 | /// 31 | /// Test generate rtf text and copy to windows clipboard 32 | /// after execute this function , you can paste rtf text in MS Word 33 | /// 34 | [Test] 35 | [RequiresThread(ApartmentState.STA)] 36 | public void TestClipboard() 37 | { 38 | System.IO.StringWriter myStr = new System.IO.StringWriter(); 39 | RTFWriter w = new RTFWriter(myStr); 40 | Helper.TestBuildRTF(w); 41 | w.Close(); 42 | System.Windows.Forms.DataObject data = new System.Windows.Forms.DataObject(); 43 | data.SetData(System.Windows.Forms.DataFormats.Rtf, myStr.ToString()); 44 | System.Windows.Forms.Clipboard.SetDataObject(data, true); 45 | System.Windows.Forms.MessageBox.Show("OK, you can paste words in MS Word."); 46 | } 47 | } 48 | } -------------------------------------------------------------------------------- /Source/RtfDomParser.Tests/packages.config: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | -------------------------------------------------------------------------------- /Source/RtfDomParser.WinFormsDemo/Program.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Windows.Forms; 4 | 5 | namespace RtfDomParser.Test 6 | { 7 | static class Program 8 | { 9 | /// 10 | /// 应用程序的主入口点。 11 | /// 12 | [STAThread] 13 | static void Main() 14 | { 15 | Defaults.FontName = System.Windows.Forms.Control.DefaultFont.Name; 16 | 17 | Application.EnableVisualStyles(); 18 | Application.SetCompatibleTextRenderingDefault(false); 19 | Application.Run(new frmRTFTest()); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Source/RtfDomParser.WinFormsDemo/RTFDemo/Blank.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg936\uc2\deff0\stshfdbch13\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe2052{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} 2 | {\f13\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f35\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}{\f36\froman\fcharset238\fprq2 Times New Roman CE;} 3 | {\f37\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f39\froman\fcharset161\fprq2 Times New Roman Greek;}{\f40\froman\fcharset162\fprq2 Times New Roman Tur;}{\f41\froman\fcharset177\fprq2 Times New Roman (Hebrew);} 4 | {\f42\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f43\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f44\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f168\fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};} 5 | {\f388\fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255; 6 | \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{ 7 | \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \snext0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\* 8 | \ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv 9 | \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\loch\f0\hich\af0\dbch\af13\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0} 10 | {\*\rsidtbl \rsid11540\rsid134188\rsid162815\rsid798820\rsid926541\rsid998216\rsid1049212\rsid1474125\rsid1603247\rsid1653933\rsid1837147\rsid1847480\rsid1998582\rsid2040385\rsid2295186\rsid2518424\rsid2631018\rsid2651046\rsid2780963\rsid2829515 11 | \rsid2848002\rsid2915979\rsid3237161\rsid3287233\rsid3413273\rsid3546859\rsid3605679\rsid3607806\rsid3812534\rsid3814506\rsid3818443\rsid4405890\rsid4465190\rsid4523966\rsid4534256\rsid4608923\rsid4678414\rsid4794674\rsid5070509\rsid5329518\rsid5461907 12 | \rsid5593893\rsid5643265\rsid5852633\rsid5921824\rsid5965968\rsid6033845\rsid6171738\rsid6176397\rsid6315211\rsid6498558\rsid6696205\rsid6978123\rsid7149107\rsid7209579\rsid7233251\rsid7284736\rsid7344432\rsid7406059\rsid7614883\rsid7630464\rsid7668226 13 | \rsid8278977\rsid8390273\rsid8726262\rsid8731371\rsid8742650\rsid8793479\rsid9178729\rsid9182936\rsid9192335\rsid9382210\rsid9402383\rsid9844676\rsid9859947\rsid9989421\rsid10040446\rsid10046897\rsid10115046\rsid10244754\rsid10382465\rsid10447167 14 | \rsid10555986\rsid10643761\rsid10814467\rsid10830584\rsid10907754\rsid11097155\rsid11280724\rsid11298349\rsid11425658\rsid11761968\rsid11798280\rsid11865385\rsid11878899\rsid12085275\rsid12144633\rsid12194446\rsid12258537\rsid12279847\rsid12339493 15 | \rsid12388787\rsid12416993\rsid12535163\rsid12610134\rsid12810764\rsid12846530\rsid12932934\rsid12983364\rsid13057553\rsid13379065\rsid13717153\rsid14115659\rsid14158007\rsid14185520\rsid14309678\rsid14370365\rsid14562311\rsid14574164\rsid14632284 16 | \rsid14640739\rsid14839801\rsid15166638\rsid15225859\rsid15231724\rsid15299559\rsid15602904\rsid15861443\rsid15998765\rsid16344647\rsid16521390\rsid16655849\rsid16663712}{\*\generator Microsoft Word 11.0.5604;}{\info{\author yfyuan}{\operator yfyuan} 17 | {\creatim\yr2010\mo9\dy2\hr9\min52}{\revtim\yr2010\mo9\dy2\hr9\min52}{\version2}{\edmins0}{\nofpages1}{\nofwords0}{\nofchars0}{\*\company sinosoft}{\nofcharsws0}{\vern24689}}\paperw11906\paperh16838\margl1800\margr1800\margt1440\margb1440\gutter0 18 | \deftab420\ftnbj\aenddoc\formshade\horzdoc\dgmargin\dghspace180\dgvspace156\dghorigin1800\dgvorigin1440\dghshow0\dgvshow2\jcompress\lnongrid 19 | \viewkind1\viewscale100\splytwnine\ftnlytwnine\htmautsp\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\viewnobound1\snaptogridincell\allowfieldendsel\wrppunct\asianbrkrule\rsidroot12339493\newtblstyruls\nogrowautofit {\*\fchars 20 | !),.:\'3b?]\'7d\'a1\'a7\'a1\'a4\'a1\'a6\'a1\'a5\'a8\'44\'a1\'ac\'a1\'af\'a1\'b1\'a1\'ad\'a1\'c3\'a1\'a2\'a1\'a3\'a1\'a8\'a1\'a9\'a1\'b5\'a1\'b7\'a1\'b9\'a1\'bb\'a1\'bf\'a1\'b3\'a1\'bd\'a3\'a1\'a3\'a2\'a3\'a7\'a3\'a9\'a3\'ac\'a3\'ae\'a3\'ba\'a3\'bb\'a3\'bf\'a3\'dd\'a3\'e0\'a3\'fc\'a3\'fd\'a1\'ab\'a1\'e9 21 | }{\*\lchars ([\'7b\'a1\'a4\'a1\'ae\'a1\'b0\'a1\'b4\'a1\'b6\'a1\'b8\'a1\'ba\'a1\'be\'a1\'b2\'a1\'bc\'a3\'a8\'a3\'ae\'a3\'db\'a3\'fb\'a1\'ea\'a3\'a4}\fet0\sectd \linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj 22 | {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang 23 | {\pntxta \dbch )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (} 24 | {\pntxta \dbch )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}\pard\plain 25 | \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\insrsid4678414 26 | \par }} -------------------------------------------------------------------------------- /Source/RtfDomParser.WinFormsDemo/RTFDemo/Formated text.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg936\uc2\deff0\stshfdbch13\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe2052{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} 2 | {\f13\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f35\fnil\fcharset134\fprq2{\*\panose 00000000000000000000}@\'cb\'ce\'cc\'e5;}{\f37\froman\fcharset238\fprq2 Times New Roman CE;} 3 | {\f38\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f40\froman\fcharset161\fprq2 Times New Roman Greek;}{\f41\froman\fcharset162\fprq2 Times New Roman Tur;}{\f42\froman\fcharset177\fprq2 Times New Roman (Hebrew);} 4 | {\f43\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f44\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f45\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f169\fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};} 5 | {\f389\fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255; 6 | \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{ 7 | \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \snext0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\* 8 | \ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv 9 | \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\loch\f0\hich\af0\dbch\af13\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\pgptbl {\pgp 10 | \ipgp0\itap0\li0\ri0\sb0\sa0}}{\*\rsidtbl \rsid11540\rsid134188\rsid162815\rsid212594\rsid798820\rsid926541\rsid998216\rsid1049212\rsid1474125\rsid1603247\rsid1653933\rsid1837147\rsid1847480\rsid1998582\rsid2040385\rsid2295186\rsid2518424\rsid2631018 11 | \rsid2651046\rsid2780963\rsid2829515\rsid2848002\rsid2915979\rsid3237161\rsid3287233\rsid3413273\rsid3546859\rsid3605679\rsid3607806\rsid3812534\rsid3814506\rsid3818443\rsid4405890\rsid4465190\rsid4523966\rsid4534256\rsid4608923\rsid4678414\rsid4794674 12 | \rsid5070509\rsid5329518\rsid5461907\rsid5593893\rsid5643265\rsid5852633\rsid5965968\rsid6033845\rsid6171738\rsid6176397\rsid6315211\rsid6498558\rsid6696205\rsid6978123\rsid7149107\rsid7209579\rsid7233251\rsid7284736\rsid7344432\rsid7406059\rsid7614883 13 | \rsid7630464\rsid7668226\rsid8278977\rsid8390273\rsid8726262\rsid8731371\rsid8742650\rsid8793479\rsid9178729\rsid9182936\rsid9192335\rsid9382210\rsid9402383\rsid9403215\rsid9844676\rsid9859947\rsid9989421\rsid10040446\rsid10046897\rsid10115046 14 | \rsid10244754\rsid10382465\rsid10447167\rsid10555986\rsid10643761\rsid10814467\rsid10830584\rsid10907754\rsid11097155\rsid11280724\rsid11298349\rsid11425658\rsid11761968\rsid11798280\rsid11865385\rsid11878899\rsid12085275\rsid12144633\rsid12194446 15 | \rsid12258537\rsid12279847\rsid12388787\rsid12416993\rsid12535163\rsid12610134\rsid12810764\rsid12846530\rsid12932934\rsid12983364\rsid13057553\rsid13379065\rsid13717153\rsid14115659\rsid14158007\rsid14179459\rsid14185520\rsid14309678\rsid14370365 16 | \rsid14562311\rsid14574164\rsid14632284\rsid14640739\rsid14839801\rsid15166638\rsid15225859\rsid15231724\rsid15299559\rsid15602904\rsid15861443\rsid15998765\rsid16344647\rsid16521390\rsid16655849\rsid16663712}{\*\generator Microsoft Word 11.0.5604;}{\info 17 | {\title 11111111111}{\author yfyuan}{\operator yfyuan}{\creatim\yr2010\mo9\dy2\hr9\min54}{\revtim\yr2010\mo9\dy25\hr10\min24}{\version3}{\edmins1}{\nofpages1}{\nofwords20}{\nofchars120}{\*\company sinosoft}{\nofcharsws139}{\vern24689}} 18 | \paperw11906\paperh16838\margl1800\margr1800\margt1440\margb1440\gutter0 \deftab420\ftnbj\aenddoc\hyphcaps0\formshade\horzdoc\dgmargin\dghspace180\dgvspace156\dghorigin1800\dgvorigin1440\dghshow0\dgvshow2\jcompress\lnongrid 19 | \viewkind1\viewscale100\splytwnine\ftnlytwnine\htmautsp\useltbaln\alntblind\lytcalctblwd\lyttblrtgr\lnbrkrule\nobrkwrptbl\viewnobound1\snaptogridincell\allowfieldendsel\wrppunct\asianbrkrule\rsidroot14179459\newtblstyruls\nogrowautofit {\*\fchars 20 | !),.:\'3b?]\'7d\'a1\'a7\'a1\'a4\'a1\'a6\'a1\'a5\'a8\'44\'a1\'ac\'a1\'af\'a1\'b1\'a1\'ad\'a1\'c3\'a1\'a2\'a1\'a3\'a1\'a8\'a1\'a9\'a1\'b5\'a1\'b7\'a1\'b9\'a1\'bb\'a1\'bf\'a1\'b3\'a1\'bd\'a3\'a1\'a3\'a2\'a3\'a7\'a3\'a9\'a3\'ac\'a3\'ae\'a3\'ba\'a3\'bb\'a3\'bf\'a3\'dd\'a3\'e0\'a3\'fc\'a3\'fd\'a1\'ab\'a1\'e9 21 | }{\*\lchars ([\'7b\'a1\'a4\'a1\'ae\'a1\'b0\'a1\'b4\'a1\'b6\'a1\'b8\'a1\'ba\'a1\'be\'a1\'b2\'a1\'bc\'a3\'a8\'a3\'ae\'a3\'db\'a3\'fb\'a1\'ea\'a3\'a4}\fet0\sectd \linex0\headery851\footery992\colsx425\endnhere\sectlinegrid312\sectspecifyl\sftnbj 22 | {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang 23 | {\pntxta \dbch )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (} 24 | {\pntxta \dbch )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}\pard\plain 25 | \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\insrsid14179459 \hich\af0\dbch\af13\loch\f0 11}{ 26 | \fs48\insrsid14179459\charrsid14179459 \hich\af0\dbch\af13\loch\f0 111}{\insrsid14179459 \hich\af0\dbch\af13\loch\f0 111111}{\insrsid4678414 27 | \par }{\insrsid14179459 \hich\af0\dbch\af13\loch\f0 222}{\cf6\insrsid14179459\charrsid14179459 \hich\af0\dbch\af13\loch\f0 22222}{\insrsid14179459 \hich\af0\dbch\af13\loch\f0 222 28 | \par }{\insrsid14179459 \loch\af0\hich\af0\dbch\f13 \'d5\'c5}{\b\i\fs32\insrsid14179459\charrsid14179459 \loch\af0\hich\af0\dbch\f13 \'c8\'fd}{\insrsid14179459 \loch\af0\hich\af0\dbch\f13 \'c0\'ee}{\b\i\fs52\ul\insrsid14179459\charrsid14179459 29 | \loch\af0\hich\af0\dbch\f13 \'cb\'c4}{\insrsid14179459 \loch\af0\hich\af0\dbch\f13 \'cd\'f5\'ce\'e5}{\insrsid14179459 30 | \par 31 | \par }{\insrsid212594 32 | \par 33 | \par 34 | \par }\pard \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid212594 {\insrsid212594 \hich\af0\dbch\af13\loch\f0 RTF Sample , Author : yuans , contact : yyf9989@hotmail.com , site : http://www.cnblogs.com/xdesigner }{ 35 | \insrsid9403215 \hich\af0\dbch\af13\loch\f0 .}{\insrsid212594 36 | \par }\pard \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 {\insrsid212594 37 | \par }} -------------------------------------------------------------------------------- /Source/RtfDomParser.WinFormsDemo/RTFDemo/Simple table.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg936\deff0\deflang1033\deflangfe2052\deftab420{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}} 2 | {\colortbl ;\red0\green0\blue255;} 3 | {\*\generator Msftedit 5.41.21.2510;}{\info{\horzdoc}{\*\lchars ([\'7b\'a1\'a4\'a1\'ae\'a1\'b0\'a1\'b4\'a1\'b6\'a1\'b8\'a1\'ba\'a1\'be\'a1\'b2\'a1\'bc\'a3\'a8\'a3\'ae\'a3\'db\'a3\'fb\'a1\'ea\'a3\'a4}{\*\fchars !),.:\'3b?]\'7d\'a1\'a7\'a1\'a4\'a1\'a6\'a1\'a5\'a8\'44\'a1\'ac\'a1\'af\'a1\'b1\'a1\'ad\'a1\'c3\'a1\'a2\'a1\'a3\'a1\'a8\'a1\'a9\'a1\'b5\'a1\'b7\'a1\'b9\'a1\'bb\'a1\'bf\'a1\'b3\'a1\'bd\'a3\'a1\'a3\'a2\'a3\'a7\'a3\'a9\'a3\'ac\'a3\'ae\'a3\'ba\'a3\'bb\'a3\'bf\'a3\'dd\'a3\'e0\'a3\'fc\'a3\'fd\'a1\'ab\'a1\'e9}} 4 | \viewkind4\uc1\pard\sa200\sl276\slmult1\f0\fs24 aaaaaaaaaaa\par 5 | \trowd\trgaph108\trleft-108\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trpaddl108\trpaddr108\trpaddfl3\trpaddfr3 6 | \clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx2732\clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx5573\clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx8414\pard\intbl\nowidctlpar\qj\kerning2\fs21 1111111111111\cell 2222222222\cell 3333333333\cell\row\trowd\trgaph108\trleft-108\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trpaddl108\trpaddr108\trpaddfl3\trpaddfr3 7 | \clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx2732\clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx5573\clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx8414\pard\intbl\nowidctlpar\qj 444444444\cell 5555555555\cell 6666666666\cell\row\trowd\trgaph108\trleft-108\trbrdrl\brdrs\brdrw10 \trbrdrt\brdrs\brdrw10 \trbrdrr\brdrs\brdrw10 \trbrdrb\brdrs\brdrw10 \trpaddl108\trpaddr108\trpaddfl3\trpaddfr3 8 | \clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx2732\clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx5573\clbrdrl\brdrw10\brdrs\clbrdrt\brdrw10\brdrs\clbrdrr\brdrw10\brdrs\clbrdrb\brdrw10\brdrs \cellx8414\pard\intbl\nowidctlpar\qj 7777777777\cell 8888888888\cell 99999999999\cell\row\pard\nowidctlpar\qj\par 9 | \par 10 | \par 11 | RTF Sample , Author : yuans , contact : yyf9989@hotmail.com , site : {\field{\*\fldinst{HYPERLINK "http://www.cnblogs.com/xdesigner"}}{\fldrslt{\ul\cf1 http://www.cnblogs.com/xdesigner}}}\f0\fs21 .\par 12 | \par 13 | } 14 | -------------------------------------------------------------------------------- /Source/RtfDomParser.WinFormsDemo/RTFDemo/Simple text.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg936\uc2\deff0\stshfdbch13\stshfloch0\stshfhich0\stshfbi0\deflang1033\deflangfe2052{\fonttbl{\f0\froman\fcharset0\fprq2{\*\panose 02020603050405020304}Times New Roman;} 2 | {\f13\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}\'cb\'ce\'cc\'e5{\*\falt SimSun};}{\f35\fnil\fcharset134\fprq2{\*\panose 02010600030101010101}@\'cb\'ce\'cc\'e5;}{\f37\froman\fcharset238\fprq2 Times New Roman CE;} 3 | {\f38\froman\fcharset204\fprq2 Times New Roman Cyr;}{\f40\froman\fcharset161\fprq2 Times New Roman Greek;}{\f41\froman\fcharset162\fprq2 Times New Roman Tur;}{\f42\froman\fcharset177\fprq2 Times New Roman (Hebrew);} 4 | {\f43\froman\fcharset178\fprq2 Times New Roman (Arabic);}{\f44\froman\fcharset186\fprq2 Times New Roman Baltic;}{\f45\froman\fcharset163\fprq2 Times New Roman (Vietnamese);}{\f169\fnil\fcharset0\fprq2 SimSun Western{\*\falt SimSun};} 5 | {\f389\fnil\fcharset0\fprq2 @\'cb\'ce\'cc\'e5 Western;}}{\colortbl;\red0\green0\blue0;\red0\green0\blue255;\red0\green255\blue255;\red0\green255\blue0;\red255\green0\blue255;\red255\green0\blue0;\red255\green255\blue0;\red255\green255\blue255; 6 | \red0\green0\blue128;\red0\green128\blue128;\red0\green128\blue0;\red128\green0\blue128;\red128\green0\blue0;\red128\green128\blue0;\red128\green128\blue128;\red192\green192\blue192;}{\stylesheet{ 7 | \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs21\lang1033\langfe2052\kerning2\loch\f0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 \snext0 Normal;}{\*\cs10 \additive \ssemihidden Default Paragraph Font;}{\* 8 | \ts11\tsrowd\trftsWidthB3\trpaddl108\trpaddr108\trpaddfl3\trpaddft3\trpaddfb3\trpaddfr3\trcbpat1\trcfpat1\tscellwidthfts0\tsvertalt\tsbrdrt\tsbrdrl\tsbrdrb\tsbrdrr\tsbrdrdgl\tsbrdrdgr\tsbrdrh\tsbrdrv 9 | \ql \li0\ri0\widctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0 \fs20\lang1024\langfe1024\loch\f0\hich\af0\dbch\af13\cgrid\langnp1024\langfenp1024 \snext11 \ssemihidden Normal Table;}}{\*\latentstyles\lsdstimax156\lsdlockeddef0}{\*\pgptbl {\pgp 10 | \ipgp0\itap0\li0\ri0\sb0\sa0}}{\*\rsidtbl \rsid1455722\rsid5901652\rsid9469694\rsid10684320\rsid13389739\rsid14579195}{\*\generator Microsoft Word 11.0.5604;}{\info{\author yfyuan}{\operator yfyuan}{\creatim\yr2010\mo9\dy3\hr15\min39} 11 | {\revtim\yr2010\mo9\dy25\hr10\min25}{\version5}{\edmins1}{\nofpages1}{\nofwords30}{\nofchars175}{\*\company sinosoft}{\nofcharsws204}{\vern24689}}\paperw12240\paperh15840\margl1800\margr1800\margt1440\margb1440\gutter0 12 | \deftab420\ftnbj\aenddoc\hyphcaps0\horzdoc\dghspace120\dgvspace120\dghorigin1701\dgvorigin1984\dghshow0\dgvshow3\jcompress\viewkind4\viewscale100\rsidroot9469694 {\*\fchars 13 | !),.:\'3b?]\'7d\'a1\'a7\'a1\'a4\'a1\'a6\'a1\'a5\'a8\'44\'a1\'ac\'a1\'af\'a1\'b1\'a1\'ad\'a1\'c3\'a1\'a2\'a1\'a3\'a1\'a8\'a1\'a9\'a1\'b5\'a1\'b7\'a1\'b9\'a1\'bb\'a1\'bf\'a1\'b3\'a1\'bd\'a3\'a1\'a3\'a2\'a3\'a7\'a3\'a9\'a3\'ac\'a3\'ae\'a3\'ba\'a3\'bb\'a3\'bf\'a3\'dd\'a3\'e0\'a3\'fc\'a3\'fd\'a1\'ab\'a1\'e9 14 | }{\*\lchars ([\'7b\'a1\'a4\'a1\'ae\'a1\'b0\'a1\'b4\'a1\'b6\'a1\'b8\'a1\'ba\'a1\'be\'a1\'b2\'a1\'bc\'a3\'a8\'a3\'ae\'a3\'db\'a3\'fb\'a1\'ea\'a3\'a4}\fet0\sectd \linex0\sectdefaultcl\sftnbj {\*\pnseclvl1\pnucrm\pnstart1\pnindent720\pnhang {\pntxta \dbch .}} 15 | {\*\pnseclvl2\pnucltr\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl3\pndec\pnstart1\pnindent720\pnhang {\pntxta \dbch .}}{\*\pnseclvl4\pnlcltr\pnstart1\pnindent720\pnhang {\pntxta \dbch )}}{\*\pnseclvl5\pndec\pnstart1\pnindent720\pnhang 16 | {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl6\pnlcltr\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl7\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl8\pnlcltr\pnstart1\pnindent720\pnhang 17 | {\pntxtb \dbch (}{\pntxta \dbch )}}{\*\pnseclvl9\pnlcrm\pnstart1\pnindent720\pnhang {\pntxtb \dbch (}{\pntxta \dbch )}}\pard\plain \qj \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 18 | \fs21\lang1033\langfe2052\kerning2\loch\af0\hich\af0\dbch\af13\cgrid\langnp1033\langfenp2052 {\cf6\insrsid9469694\charrsid13389739 \loch\af0\dbch\af13\hich\f0 \'b1}{\cf1\lang2052\langfe2052\loch\af13\langnp2052\insrsid5901652 \loch\af13\hich\af0\dbch\f13 19 | \'a1\'c0}{\cf6\insrsid9469694\charrsid13389739 \hich\af0\dbch\af13\loch\f0 (5.5}{\cf6\hich\af13\insrsid9469694\charrsid13389739 \loch\af0\hich\af13\dbch\f13 \'a1\'ab}{\cf6\insrsid9469694\charrsid13389739 \hich\af0\dbch\af13\loch\f0 500)}{ 20 | \cf1\lang2052\langfe2052\loch\af13\langnp2052\insrsid9469694 21 | \par }{\insrsid9469694 \hich\af0\dbch\af13\loch\f0 111111111111111111111 22 | \par \hich\af0\dbch\af13\loch\f0 2222222222222\line 222222222 23 | \par \hich\af0\dbch\af13\loch\f0 333333333333333333333 24 | \par }{\lang2052\langfe2052\loch\af13\langnp2052\insrsid9469694 \loch\af13\hich\af0\dbch\f13 \'d5\'c5\'c8\'fd\'c0\'ee\'cb\'c4\'cd\'f5\'ce\'e5}{\insrsid9469694 \hich\af0\dbch\af13\loch\f0 (5.5}{\lang2052\langfe2052\loch\af13\langnp2052\insrsid9469694 25 | \loch\af13\hich\af0\dbch\f13 \'a1\'ab}{\insrsid9469694 \hich\af0\dbch\af13\loch\f0 500) 26 | \par }{\insrsid10684320 27 | \par 28 | \par 29 | \par }\pard \qj \li0\ri0\nowidctlpar\aspalpha\aspnum\faauto\adjustright\rin0\lin0\itap0\pararsid10684320 {\insrsid10684320 \hich\af0\dbch\af13\loch\f0 RTF Sample , Author : yuans , contact : yyf9989@hotmail.com , site : http://www.cnblogs.com/xdesigner }{ 30 | \insrsid1455722 \hich\af0\dbch\af13\loch\f0 .}{\insrsid10684320\charrsid1455722 31 | \par }\pard \qj \li0\ri0\nowidctlpar\faauto\rin0\lin0\itap0 {\insrsid10684320\charrsid10684320 32 | \par }} -------------------------------------------------------------------------------- /Source/RtfDomParser.WinFormsDemo/RTFDemo/htmlrtf2.rtf: -------------------------------------------------------------------------------- 1 | {\rtf1\ansi\ansicpg1252\fromhtml1 \fbidis \deff0{\fonttbl 2 | {\f0\fswiss Arial;} 3 | {\f1\fmodern Courier New;} 4 | {\f2\fnil\fcharset2 Symbol;} 5 | {\f3\fmodern\fcharset0 Courier New;} 6 | {\f4\fswiss\fcharset0 Tahoma;}} 7 | {\colortbl\red0\green0\blue0;\red0\green0\blue255;\red0\green0\blue255;} 8 | \uc1\pard\plain\deftab360 \f0\fs24 9 | {\*\htmltag243 } 12 | {\*\htmltag64

}\htmlrtf {\htmlrtf0 13 | {\*\htmltag148 }\htmlrtf {\fs20 \htmlrtf0 14 | {\*\htmltag148 }\htmlrtf {\f4 \htmlrtf0 15 | {\*\htmltag84 }\htmlrtf {\htmlrtf0 16 | {\*\htmltag84 }\htmlrtf {\htmlrtf0 17 | {\*\htmltag84 }\htmlrtf {\field{\*\fldinst{HYPERLINK "http://web2.intomartgfk.nl/htmlmail/images/panelintomartgfk.jpg"}}{\fldrslt\cf1\ul }}\htmlrtf0 18 | {\*\htmltag92 }\htmlrtf }\htmlrtf0 19 | {\*\htmltag92 }\htmlrtf }\htmlrtf0 20 | {\*\htmltag156 }\htmlrtf }\htmlrtf0 21 | {\*\htmltag156 }\htmlrtf }\htmlrtf0 \htmlrtf\par}\htmlrtf0 22 | \htmlrtf \par 23 | \htmlrtf0 24 | {\*\htmltag72

}{\*\htmltag64}\htmlrtf {\htmlrtf0 25 | {\*\htmltag148 }\htmlrtf {\fs20 \htmlrtf0 26 | {\*\htmltag148 }\htmlrtf {\f4 \htmlrtf0 27 | {\*\htmltag84 }\htmlrtf {\htmlrtf0 28 | {\*\htmltag84 }\htmlrtf {\htmlrtf0 29 | {\*\htmltag4 \par }{\*\htmltag72} 30 | {\*\htmltag68

} 31 | {\*\htmltag148 }\htmlrtf {\fs20 \htmlrtf0 32 | {\*\htmltag148 }\htmlrtf {\f4 \htmlrtf0 33 | {\*\htmltag84 }\htmlrtf {\htmlrtf0 Beste CMMA van Spelde, 34 | {\*\htmltag116
}\htmlrtf \line 35 | \htmlrtf0 36 | {\*\htmltag84  }\htmlrtf \'a0\htmlrtf0 37 | {\*\htmltag116
}\htmlrtf \line 38 | \htmlrtf0 Binnenkort gaan enkele 39 | {\*\htmltag84  }\htmlrtf \'a0\htmlrtf0 onderzoeken van start. Om na te gaan of u hieraan kunt deelnemen, verzoeken wij u vriendelijk enkele vragen te beantwoorden. Het beantwoorden van deze vragenlijst duurt ongeveer 40 | {\*\htmltag84  }\htmlrtf \'a0\htmlrtf0 10 minuten. 41 | {\*\htmltag92
}\htmlrtf }\htmlrtf0 42 | {\*\htmltag156
}\htmlrtf }\htmlrtf0 43 | {\*\htmltag156
}\htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf\par}\htmlrtf0 44 | \htmlrtf \par 45 | \htmlrtf0 46 | {\*\htmltag72

} 47 | {\*\htmltag0 \par } 48 | {\*\htmltag64

}\htmlrtf {\htmlrtf0 \htmlrtf {\fs20 \htmlrtf0 \htmlrtf {\f4 \htmlrtf0 \htmlrtf {\htmlrtf0 \htmlrtf {\htmlrtf0 49 | {\*\htmltag148 }\htmlrtf {\fs20 \htmlrtf0 50 | {\*\htmltag148 }\htmlrtf {\f4 \htmlrtf0 51 | {\*\htmltag84 }\htmlrtf {\htmlrtf0 Klik op onderstaande link of kopieer deze link naar het programma waarmee u op internet surft: 52 | {\*\htmltag116
}\htmlrtf \line 53 | \htmlrtf0 54 | {\*\htmltag92
}\htmlrtf }\htmlrtf0 55 | {\*\htmltag84 }\htmlrtf {\field{\*\fldinst{HYPERLINK "http://www1.gfk-wi.com/wix/p274946947.aspx?r=56657&s=QUKGLPKJ"}}{\fldrslt\cf1\ul \htmlrtf0 http://www1.gfk-wi.com/wix/p274946947.aspx?r=56657 56 | {\*\htmltag84 &}\htmlrtf &\htmlrtf0 s=QUKGLPKJ\htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 57 | {\*\htmltag92 } 58 | {\*\htmltag156
}\htmlrtf }\htmlrtf0 59 | {\*\htmltag156
}\htmlrtf }\htmlrtf0 60 | {\*\htmltag84 }\htmlrtf {\htmlrtf0 61 | {\*\htmltag116
}\htmlrtf \line 62 | \htmlrtf0 63 | {\*\htmltag148 }\htmlrtf {\fs20 \f4 \htmlrtf0 64 | {\*\htmltag84  }\htmlrtf \'a0\htmlrtf0 65 | {\*\htmltag116
}\htmlrtf \line 66 | \htmlrtf0 U kunt de vragenlijst nog invullen tot en met 67 | {\*\htmltag84  }\htmlrtf \'a0\htmlrtf0 31 oktober. 68 | {\*\htmltag156
}\htmlrtf }\htmlrtf0 69 | {\*\htmltag92
}\htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf\par}\htmlrtf0 70 | \htmlrtf \par 71 | \htmlrtf0 72 | {\*\htmltag72

}{\*\htmltag64}\htmlrtf {\htmlrtf0 \htmlrtf {\fs20 \htmlrtf0 \htmlrtf {\f4 \htmlrtf0 \htmlrtf {\htmlrtf0 \htmlrtf {\htmlrtf0 73 | {\*\htmltag84 }\htmlrtf {\htmlrtf0 74 | {\*\htmltag148 }\htmlrtf {\fs20 \f4 \htmlrtf0 75 | {\*\htmltag4 \par }{\*\htmltag72} 76 | {\*\htmltag68

} 77 | {\*\htmltag156 }\htmlrtf }\htmlrtf0 78 | {\*\htmltag92 }\htmlrtf }\htmlrtf0 79 | {\*\htmltag84 }\htmlrtf {\htmlrtf0 80 | {\*\htmltag148 }\htmlrtf {\fs20 \f4 \htmlrtf0 Bij het invullen van de vragenlijst maakt u kans op een van de 20 bedragen van 20 euro die wij verloten onder de deelnemers! 81 | {\*\htmltag116
}\htmlrtf \line 82 | \htmlrtf0 Indien u tot de gelukkigen behoort, ontvangt u hierover binnen een week na het afsluiten van het 83 | {\*\htmltag84  }\htmlrtf \'a0\htmlrtf0 onderzoek een bericht en wordt het bedrag aan uw saldo toegevoegd! 84 | {\*\htmltag116
}\htmlrtf \line 85 | \htmlrtf0 86 | {\*\htmltag116
}\htmlrtf \line 87 | \htmlrtf0 Indien u aan de onderzoeken kunt deelnemen ontvangt u binnenkort van ons een uitnodiging. 88 | {\*\htmltag156
}\htmlrtf }\htmlrtf0 89 | {\*\htmltag92
}\htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf\par}\htmlrtf0 90 | \htmlrtf \par 91 | \htmlrtf0 92 | {\*\htmltag72

} 93 | {\*\htmltag0 \par } 94 | {\*\htmltag64

}\htmlrtf {\htmlrtf0 \htmlrtf {\fs20 \htmlrtf0 \htmlrtf {\f4 \htmlrtf0 \htmlrtf {\htmlrtf0 \htmlrtf {\htmlrtf0 95 | {\*\htmltag84 }\htmlrtf {\htmlrtf0 96 | {\*\htmltag148 }\htmlrtf {\fs20 \f4 \htmlrtf0 Het is 97 | {\*\htmltag84  }\htmlrtf \'a0\htmlrtf0 van groot belang 98 | {\*\htmltag84  }\htmlrtf \'a0\htmlrtf0 dat alleen de persoon waaraan dit bericht is gericht de vragen invult. 99 | {\*\htmltag156 }\htmlrtf }\htmlrtf0 100 | {\*\htmltag92 }\htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf\par}\htmlrtf0 101 | \htmlrtf \par 102 | \htmlrtf0 103 | {\*\htmltag72

} 104 | {\*\htmltag0 \par } 105 | {\*\htmltag64

}\htmlrtf {\htmlrtf0 \htmlrtf {\fs20 \htmlrtf0 \htmlrtf {\f4 \htmlrtf0 \htmlrtf {\htmlrtf0 \htmlrtf {\htmlrtf0 106 | {\*\htmltag84 }\htmlrtf {\htmlrtf0 107 | {\*\htmltag148 }\htmlrtf {\fs20 \f4 \htmlrtf0 Bij voorbaat onze hartelijke dank voor uw deelname! 108 | {\*\htmltag116
}\htmlrtf \line 109 | \htmlrtf0 110 | {\*\htmltag84  }\htmlrtf \'a0\htmlrtf0 111 | {\*\htmltag116
}\htmlrtf \line 112 | \htmlrtf0 Met vriendelijke groet, 113 | {\*\htmltag116
}\htmlrtf \line 114 | \htmlrtf0 115 | {\*\htmltag156
}\htmlrtf }\htmlrtf0 116 | {\*\htmltag92
}\htmlrtf }\htmlrtf0 117 | {\*\htmltag84 }\htmlrtf {\htmlrtf0 118 | {\*\htmltag148 }\htmlrtf {\fs20 \f4 \htmlrtf0 Intomart GfK Online Team 119 | {\*\htmltag116
}\htmlrtf \line 120 | \htmlrtf0 121 | {\*\htmltag156
}\htmlrtf }\htmlrtf0 122 | {\*\htmltag92
}\htmlrtf }\htmlrtf0 123 | {\*\htmltag84 }\htmlrtf {\field{\*\fldinst{HYPERLINK "mailto:panel.intomart@gfk.com"}}{\fldrslt\cf1\ul \htmlrtf0 124 | {\*\htmltag84 }\htmlrtf {\ul \htmlrtf0 125 | {\*\htmltag148 }\htmlrtf {\cf2 \fs20 \f4 \htmlrtf0 panel.intomart@gfk.com 126 | {\*\htmltag156 }\htmlrtf }\htmlrtf0 127 | {\*\htmltag92 }\htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 128 | {\*\htmltag92 } 129 | {\*\htmltag84 }\htmlrtf {\htmlrtf0 130 | {\*\htmltag116
}\htmlrtf \line 131 | \htmlrtf0 132 | {\*\htmltag148 }\htmlrtf {\fs20 \f4 \htmlrtf0 133 | {\*\htmltag84  }\htmlrtf \'a0\htmlrtf0 134 | {\*\htmltag116
}\htmlrtf \line 135 | \htmlrtf0 ******* 136 | {\*\htmltag116
}\htmlrtf \line 137 | \htmlrtf0 Uw persoonlijke omgeving op Panel.IntomartGfK is: 138 | {\*\htmltag116
}\htmlrtf \line 139 | \htmlrtf0 140 | {\*\htmltag156
}\htmlrtf }\htmlrtf0 141 | {\*\htmltag92
}\htmlrtf }\htmlrtf0 142 | {\*\htmltag84 }\htmlrtf {\field{\*\fldinst{HYPERLINK "https://panel.intomartgfk.nl/login.asp?rp=10730167&pw=79hzoI3Q"}}{\fldrslt\cf1\ul \htmlrtf0 143 | {\*\htmltag148 }\htmlrtf {\fs20 \f4 \htmlrtf0 https://panel.intomartgfk.nl/login.asp?rp=10730167 144 | {\*\htmltag84 &}\htmlrtf &\htmlrtf0 pw=79hzoI3Q 145 | {\*\htmltag156 }\htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 146 | {\*\htmltag92 } 147 | {\*\htmltag84 }\htmlrtf {\htmlrtf0 148 | {\*\htmltag116
}\htmlrtf \line 149 | \htmlrtf0 150 | {\*\htmltag148 }\htmlrtf {\fs20 \f4 \htmlrtf0 151 | {\*\htmltag84  }\htmlrtf \'a0\htmlrtf0 152 | {\*\htmltag116
}\htmlrtf \line 153 | \htmlrtf0 Hier treft u uw persoonlijke gegevens aan en informatie over online onderzoek van Intomart GfK. 154 | {\*\htmltag116
}\htmlrtf \line 155 | \htmlrtf0 Tevens vindt u hier informatie over: 156 | {\*\htmltag116
}\htmlrtf \line 157 | \htmlrtf0 - waarborging van uw privacy; 158 | {\*\htmltag116
}\htmlrtf \line 159 | \htmlrtf0 - ons vergoedings- en incentive systeem; 160 | {\*\htmltag116
}\htmlrtf \line 161 | \htmlrtf0 - hoe u uit te schrijven bij Panel.IntomartGfK 162 | {\*\htmltag116
}\htmlrtf \line 163 | \htmlrtf0 164 | {\*\htmltag84  }\htmlrtf \'a0\htmlrtf0 165 | {\*\htmltag116
}\htmlrtf \line 166 | \htmlrtf0 Ook leden van uw huishouden kunnen zich hier aanmelden voor deelname. 167 | {\*\htmltag116
}\htmlrtf \line 168 | \htmlrtf0 169 | {\*\htmltag84  }\htmlrtf \'a0\htmlrtf0 170 | {\*\htmltag116
}\htmlrtf \line 171 | \htmlrtf0 Elk gezinslid kan zich eenmaal aanmelden. 172 | {\*\htmltag156
}\htmlrtf }\htmlrtf0 173 | {\*\htmltag92
}\htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf }\htmlrtf0 \htmlrtf\par}\htmlrtf0 174 | \htmlrtf \par 175 | \htmlrtf0 176 | {\*\htmltag72

} 177 | {\*\htmltag248
} 178 | {\*\htmltag248
} 179 | {\*\htmltag248
} 180 | {\*\htmltag248
} 181 | {\*\htmltag0 \par } 182 | {\*\htmltag64

}\htmlrtf {\htmlrtf0 \htmlrtf}\htmlrtf0 183 | 184 | {\*\htmltag72

}} -------------------------------------------------------------------------------- /Source/RtfDomParser.WinFormsDemo/RtfDomParser.WinFormsDemo.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | WinExe 5 | net7.0-windows 6 | true 7 | 8 | RtfDomParser.Test 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | Always 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /Source/RtfDomParser.WinFormsDemo/frmRTFTest.Designer.cs: -------------------------------------------------------------------------------- 1 | namespace RtfDomParser.Test 2 | { 3 | partial class frmRTFTest 4 | { 5 | /// 6 | /// 必需的设计器变量。 7 | /// 8 | private System.ComponentModel.IContainer components = null; 9 | 10 | /// 11 | /// 清理所有正在使用的资源。 12 | /// 13 | /// 如果应释放托管资源,为 true;否则为 false。 14 | protected override void Dispose(bool disposing) 15 | { 16 | if (disposing && (components != null)) 17 | { 18 | components.Dispose(); 19 | } 20 | base.Dispose(disposing); 21 | } 22 | 23 | #region Windows 窗体设计器生成的代码 24 | 25 | /// 26 | /// 设计器支持所需的方法 - 不要 27 | /// 使用代码编辑器修改此方法的内容。 28 | /// 29 | private void InitializeComponent() 30 | { 31 | System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(frmRTFTest)); 32 | this.toolStrip1 = new System.Windows.Forms.ToolStrip(); 33 | this.btnLoadRTF = new System.Windows.Forms.ToolStripButton(); 34 | this.btnLoadClipboardRTF = new System.Windows.Forms.ToolStripButton(); 35 | this.toolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator(); 36 | this.myProgress = new System.Windows.Forms.ToolStripProgressBar(); 37 | this.txtRTFDom = new System.Windows.Forms.TextBox(); 38 | this.label1 = new System.Windows.Forms.Label(); 39 | this.tabControl1 = new System.Windows.Forms.TabControl(); 40 | this.tabPage1 = new System.Windows.Forms.TabPage(); 41 | this.tabPage2 = new System.Windows.Forms.TabPage(); 42 | this.txtRTFSource = new System.Windows.Forms.TextBox(); 43 | this.toolStrip2 = new System.Windows.Forms.ToolStrip(); 44 | this.btnLoadFile = new System.Windows.Forms.ToolStripButton(); 45 | this.btnCopyText = new System.Windows.Forms.ToolStripButton(); 46 | this.btnCopyRTF = new System.Windows.Forms.ToolStripButton(); 47 | this.toolStrip1.SuspendLayout(); 48 | this.tabControl1.SuspendLayout(); 49 | this.tabPage1.SuspendLayout(); 50 | this.tabPage2.SuspendLayout(); 51 | this.toolStrip2.SuspendLayout(); 52 | this.SuspendLayout(); 53 | // 54 | // toolStrip1 55 | // 56 | resources.ApplyResources(this.toolStrip1, "toolStrip1"); 57 | this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 58 | this.btnLoadRTF, 59 | this.btnLoadClipboardRTF, 60 | this.toolStripSeparator1, 61 | this.myProgress}); 62 | this.toolStrip1.Name = "toolStrip1"; 63 | this.toolStrip1.ShowItemToolTips = false; 64 | // 65 | // btnLoadRTF 66 | // 67 | resources.ApplyResources(this.btnLoadRTF, "btnLoadRTF"); 68 | this.btnLoadRTF.Name = "btnLoadRTF"; 69 | this.btnLoadRTF.Click += new System.EventHandler(this.btnLoadRTF_Click); 70 | // 71 | // btnLoadClipboardRTF 72 | // 73 | resources.ApplyResources(this.btnLoadClipboardRTF, "btnLoadClipboardRTF"); 74 | this.btnLoadClipboardRTF.Name = "btnLoadClipboardRTF"; 75 | this.btnLoadClipboardRTF.Click += new System.EventHandler(this.btnLoadClipboardRTF_Click); 76 | // 77 | // toolStripSeparator1 78 | // 79 | resources.ApplyResources(this.toolStripSeparator1, "toolStripSeparator1"); 80 | this.toolStripSeparator1.Name = "toolStripSeparator1"; 81 | // 82 | // myProgress 83 | // 84 | resources.ApplyResources(this.myProgress, "myProgress"); 85 | this.myProgress.Name = "myProgress"; 86 | // 87 | // txtRTFDom 88 | // 89 | resources.ApplyResources(this.txtRTFDom, "txtRTFDom"); 90 | this.txtRTFDom.Name = "txtRTFDom"; 91 | // 92 | // label1 93 | // 94 | resources.ApplyResources(this.label1, "label1"); 95 | this.label1.BackColor = System.Drawing.Color.White; 96 | this.label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; 97 | this.label1.Name = "label1"; 98 | // 99 | // tabControl1 100 | // 101 | resources.ApplyResources(this.tabControl1, "tabControl1"); 102 | this.tabControl1.Controls.Add(this.tabPage1); 103 | this.tabControl1.Controls.Add(this.tabPage2); 104 | this.tabControl1.Name = "tabControl1"; 105 | this.tabControl1.SelectedIndex = 0; 106 | // 107 | // tabPage1 108 | // 109 | resources.ApplyResources(this.tabPage1, "tabPage1"); 110 | this.tabPage1.Controls.Add(this.txtRTFDom); 111 | this.tabPage1.Controls.Add(this.toolStrip1); 112 | this.tabPage1.Name = "tabPage1"; 113 | this.tabPage1.UseVisualStyleBackColor = true; 114 | // 115 | // tabPage2 116 | // 117 | resources.ApplyResources(this.tabPage2, "tabPage2"); 118 | this.tabPage2.Controls.Add(this.txtRTFSource); 119 | this.tabPage2.Controls.Add(this.toolStrip2); 120 | this.tabPage2.Name = "tabPage2"; 121 | this.tabPage2.UseVisualStyleBackColor = true; 122 | // 123 | // txtRTFSource 124 | // 125 | resources.ApplyResources(this.txtRTFSource, "txtRTFSource"); 126 | this.txtRTFSource.Name = "txtRTFSource"; 127 | // 128 | // toolStrip2 129 | // 130 | resources.ApplyResources(this.toolStrip2, "toolStrip2"); 131 | this.toolStrip2.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { 132 | this.btnLoadFile, 133 | this.btnCopyText, 134 | this.btnCopyRTF}); 135 | this.toolStrip2.Name = "toolStrip2"; 136 | this.toolStrip2.ShowItemToolTips = false; 137 | // 138 | // btnLoadFile 139 | // 140 | resources.ApplyResources(this.btnLoadFile, "btnLoadFile"); 141 | this.btnLoadFile.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; 142 | this.btnLoadFile.Name = "btnLoadFile"; 143 | this.btnLoadFile.Click += new System.EventHandler(this.btnLoadFile_Click); 144 | // 145 | // btnCopyText 146 | // 147 | resources.ApplyResources(this.btnCopyText, "btnCopyText"); 148 | this.btnCopyText.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; 149 | this.btnCopyText.Name = "btnCopyText"; 150 | this.btnCopyText.Click += new System.EventHandler(this.btnCopyText_Click); 151 | // 152 | // btnCopyRTF 153 | // 154 | resources.ApplyResources(this.btnCopyRTF, "btnCopyRTF"); 155 | this.btnCopyRTF.DisplayStyle = System.Windows.Forms.ToolStripItemDisplayStyle.Text; 156 | this.btnCopyRTF.Name = "btnCopyRTF"; 157 | this.btnCopyRTF.Click += new System.EventHandler(this.btnCopyRTF_Click); 158 | // 159 | // frmRTFTest 160 | // 161 | resources.ApplyResources(this, "$this"); 162 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; 163 | this.Controls.Add(this.tabControl1); 164 | this.Controls.Add(this.label1); 165 | this.Name = "frmRTFTest"; 166 | this.toolStrip1.ResumeLayout(false); 167 | this.toolStrip1.PerformLayout(); 168 | this.tabControl1.ResumeLayout(false); 169 | this.tabPage1.ResumeLayout(false); 170 | this.tabPage1.PerformLayout(); 171 | this.tabPage2.ResumeLayout(false); 172 | this.tabPage2.PerformLayout(); 173 | this.toolStrip2.ResumeLayout(false); 174 | this.toolStrip2.PerformLayout(); 175 | this.ResumeLayout(false); 176 | 177 | } 178 | 179 | #endregion 180 | 181 | private System.Windows.Forms.ToolStrip toolStrip1; 182 | private System.Windows.Forms.ToolStripButton btnLoadRTF; 183 | private System.Windows.Forms.TextBox txtRTFDom; 184 | private System.Windows.Forms.Label label1; 185 | private System.Windows.Forms.ToolStripSeparator toolStripSeparator1; 186 | private System.Windows.Forms.ToolStripProgressBar myProgress; 187 | private System.Windows.Forms.ToolStripButton btnLoadClipboardRTF; 188 | private System.Windows.Forms.TabControl tabControl1; 189 | private System.Windows.Forms.TabPage tabPage1; 190 | private System.Windows.Forms.TabPage tabPage2; 191 | private System.Windows.Forms.TextBox txtRTFSource; 192 | private System.Windows.Forms.ToolStrip toolStrip2; 193 | private System.Windows.Forms.ToolStripButton btnLoadFile; 194 | private System.Windows.Forms.ToolStripButton btnCopyText; 195 | private System.Windows.Forms.ToolStripButton btnCopyRTF; 196 | } 197 | } 198 | 199 | -------------------------------------------------------------------------------- /Source/RtfDomParser.WinFormsDemo/frmRTFTest.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | using System; 10 | using System.Collections.Generic; 11 | using System.ComponentModel; 12 | using System.Data; 13 | using System.Drawing; 14 | using System.Text; 15 | using System.Windows.Forms; 16 | using RtfDomParser; 17 | 18 | namespace RtfDomParser.Test 19 | { 20 | public partial class frmRTFTest : Form 21 | { 22 | public frmRTFTest() 23 | { 24 | InitializeComponent(); 25 | } 26 | 27 | private void btnLoadRTF_Click(object sender, EventArgs e) 28 | { 29 | using (OpenFileDialog dlg = new OpenFileDialog()) 30 | { 31 | dlg.Filter = "*.RTF|*.rtf"; 32 | dlg.CheckFileExists = true; 33 | if (dlg.ShowDialog(this) == DialogResult.OK) 34 | { 35 | this.Update(); 36 | RtfDomParser.RTFDomDocument doc = new RtfDomParser.RTFDomDocument(); 37 | doc.Progress += new ProgressEventHandler(doc_Progress); 38 | doc.Load(dlg.FileName); 39 | txtRTFDom.Text = doc.ToDomString(); 40 | this.Text = dlg.FileName; 41 | myProgress.Value = 0; 42 | } 43 | } 44 | } 45 | 46 | void doc_Progress(object sender, ProgressEventArgs args) 47 | { 48 | myProgress.Maximum = args.MaxValue; 49 | myProgress.Value = args.Value; 50 | } 51 | 52 | private void btnLoadClipboardRTF_Click(object sender, EventArgs e) 53 | { 54 | IDataObject ido = Clipboard.GetDataObject(); 55 | if (ido.GetDataPresent(DataFormats.Rtf)) 56 | { 57 | string rtf = ( string ) ido.GetData(DataFormats.Rtf); 58 | RTFDomDocument doc = new RTFDomDocument(); 59 | doc.Progress +=new ProgressEventHandler(doc_Progress); 60 | doc.LoadRTFText(rtf); 61 | txtRTFDom.Text = doc.ToDomString(); 62 | this.Text = ""; 63 | myProgress.Value = 0; 64 | 65 | } 66 | } 67 | 68 | private void btnLoadFile_Click(object sender, EventArgs e) 69 | { 70 | using (OpenFileDialog dlg = new OpenFileDialog()) 71 | { 72 | dlg.Filter = "*.RTF|*.rtf"; 73 | dlg.CheckFileExists = true; 74 | if (dlg.ShowDialog(this) == DialogResult.OK) 75 | { 76 | using (System.IO.StreamReader reader = new System.IO.StreamReader(dlg.FileName, Encoding.ASCII)) 77 | { 78 | txtRTFSource.Text = reader.ReadToEnd(); 79 | this.Text = dlg.FileName; 80 | } 81 | } 82 | } 83 | } 84 | 85 | private void btnCopyText_Click(object sender, EventArgs e) 86 | { 87 | Clipboard.SetData(DataFormats.Text, txtRTFSource.Text); 88 | } 89 | 90 | private void btnCopyRTF_Click(object sender, EventArgs e) 91 | { 92 | Clipboard.SetData(DataFormats.Rtf, txtRTFSource.Text); 93 | } 94 | } 95 | } -------------------------------------------------------------------------------- /Source/RtfDomParser.WinFormsDemo/frmRTFTest.en.resx: -------------------------------------------------------------------------------- 1 |  2 | 3 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | 88 | 89 | 90 | 91 | 92 | 93 | 94 | 95 | 96 | 97 | 98 | 99 | 100 | 101 | 102 | 103 | 104 | 105 | 106 | 107 | 108 | 109 | text/microsoft-resx 110 | 111 | 112 | 2.0 113 | 114 | 115 | System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 116 | 117 | 118 | System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 119 | 120 | 121 | 122 | 123 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 124 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIISURBVDhPpZP7S1NxGMbPPxKaXVUkMEq8IpKUCoY/hGgI 125 | ymqkDYYXcCjDZOANURSjCNGFQUTsl4GXVMxKk62YU4fXQpaIlygHQxBRH8/zwvyaIAYe+HLgnPN8nue9 126 | HA3nvDTq63oW/jm13XOwvPTB3DYFY5MH+bXfcN8ygfTSMSSXfESicQDxBqdYHwH29g9w2tnZ3UcguIvN 127 | rR3417exuBJE5N1n/wfwLgXEOc38Bc6xNRHb+/y4nm49G0Bnit2zf9H6bkliE/jKuYxrd6oVgDWfjB+K 128 | TWeKMyrGEVfowITvD9re/9ABVQrAhh0HHK+ZselMMaN/mvwtDb+aVqkA7HYIwIj3ysfluPTorJnP6Ezx 129 | oHsD1s5ZXEktUwCOioB5f1CEPR9+wTG6iuiserTo8dkwng7HT/R+XUPF8xlcTjErAOdMcW6NW8STiwG8 130 | 7vej8oUPN/PsEv3t8Ao0TZP3T1u8uJRkUgAuSYHtO97oLxmXd5t9Ho8aPTK+GzntqNfrLm2fFoihwYOI 131 | xGIF4KjoGBLzY1OrF9k6OOFxnwDC4wxIMX1G0pMhgVyMNyoA13PAtS7OrJk1PrC69LUdQWxuF6IybHrX 132 | LRI7JrtZdoDAo1XmbjMyD+tjSXxGcXRmnYg5ttD9QuxDhN0uUgDOmbvNTpPOJaGAo2K36cyaGZvOFIfd 133 | KlSA8/zRh9ABIDUG+1JpAAAAAElFTkSuQmCC 134 | 135 | 136 | 137 | 112, 22 138 | 139 | 140 | Load RTF file... 141 | 142 | 143 | 144 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 145 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIISURBVDhPpZP7S1NxGMbPPxKaXVUkMEq8IpKUCoY/hGgI 146 | ymqkDYYXcCjDZOANURSjCNGFQUTsl4GXVMxKk62YU4fXQpaIlygHQxBRH8/zwvyaIAYe+HLgnPN8nue9 147 | HA3nvDTq63oW/jm13XOwvPTB3DYFY5MH+bXfcN8ygfTSMSSXfESicQDxBqdYHwH29g9w2tnZ3UcguIvN 148 | rR3417exuBJE5N1n/wfwLgXEOc38Bc6xNRHb+/y4nm49G0Bnit2zf9H6bkliE/jKuYxrd6oVgDWfjB+K 149 | TWeKMyrGEVfowITvD9re/9ABVQrAhh0HHK+ZselMMaN/mvwtDb+aVqkA7HYIwIj3ysfluPTorJnP6Ezx 150 | oHsD1s5ZXEktUwCOioB5f1CEPR9+wTG6iuiserTo8dkwng7HT/R+XUPF8xlcTjErAOdMcW6NW8STiwG8 151 | 7vej8oUPN/PsEv3t8Ao0TZP3T1u8uJRkUgAuSYHtO97oLxmXd5t9Ho8aPTK+GzntqNfrLm2fFoihwYOI 152 | xGIF4KjoGBLzY1OrF9k6OOFxnwDC4wxIMX1G0pMhgVyMNyoA13PAtS7OrJk1PrC69LUdQWxuF6IybHrX 153 | LRI7JrtZdoDAo1XmbjMyD+tjSXxGcXRmnYg5ttD9QuxDhN0uUgDOmbvNTpPOJaGAo2K36cyaGZvOFIfd 154 | KlSA8/zRh9ABIDUG+1JpAAAAAElFTkSuQmCC 155 | 156 | 157 | 158 | 158, 22 159 | 160 | 161 | Load RTF in Clipboard 162 | 163 | 164 | This software is developed by Yuan yong fu , It can parse RTF source and generate DOM tree,It support table and nested table , support merge cell in rows and columns . Party of it is come from another open source software . Author's mail:yyf9989@hotmail.com,blog site:http://www.cnblogs.com/xdesigner. 165 | 166 | 167 | Parser RTF 168 | 169 | 170 | 171 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 172 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIISURBVDhPpZP7S1NxGMbPPxKaXVUkMEq8IpKUCoY/hGgI 173 | ymqkDYYXcCjDZOANURSjCNGFQUTsl4GXVMxKk62YU4fXQpaIlygHQxBRH8/zwvyaIAYe+HLgnPN8nue9 174 | HA3nvDTq63oW/jm13XOwvPTB3DYFY5MH+bXfcN8ygfTSMSSXfESicQDxBqdYHwH29g9w2tnZ3UcguIvN 175 | rR3417exuBJE5N1n/wfwLgXEOc38Bc6xNRHb+/y4nm49G0Bnit2zf9H6bkliE/jKuYxrd6oVgDWfjB+K 176 | TWeKMyrGEVfowITvD9re/9ABVQrAhh0HHK+ZselMMaN/mvwtDb+aVqkA7HYIwIj3ysfluPTorJnP6Ezx 177 | oHsD1s5ZXEktUwCOioB5f1CEPR9+wTG6iuiserTo8dkwng7HT/R+XUPF8xlcTjErAOdMcW6NW8STiwG8 178 | 7vej8oUPN/PsEv3t8Ao0TZP3T1u8uJRkUgAuSYHtO97oLxmXd5t9Ho8aPTK+GzntqNfrLm2fFoihwYOI 179 | xGIF4KjoGBLzY1OrF9k6OOFxnwDC4wxIMX1G0pMhgVyMNyoA13PAtS7OrJk1PrC69LUdQWxuF6IybHrX 180 | LRI7JrtZdoDAo1XmbjMyD+tjSXxGcXRmnYg5ttD9QuxDhN0uUgDOmbvNTpPOJaGAo2K36cyaGZvOFIfd 181 | KlSA8/zRh9ABIDUG+1JpAAAAAElFTkSuQmCC 182 | 183 | 184 | 185 | 71, 22 186 | 187 | 188 | Load file... 189 | 190 | 191 | 192 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 193 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIISURBVDhPpZP7S1NxGMbPPxKaXVUkMEq8IpKUCoY/hGgI 194 | ymqkDYYXcCjDZOANURSjCNGFQUTsl4GXVMxKk62YU4fXQpaIlygHQxBRH8/zwvyaIAYe+HLgnPN8nue9 195 | HA3nvDTq63oW/jm13XOwvPTB3DYFY5MH+bXfcN8ygfTSMSSXfESicQDxBqdYHwH29g9w2tnZ3UcguIvN 196 | rR3417exuBJE5N1n/wfwLgXEOc38Bc6xNRHb+/y4nm49G0Bnit2zf9H6bkliE/jKuYxrd6oVgDWfjB+K 197 | TWeKMyrGEVfowITvD9re/9ABVQrAhh0HHK+ZselMMaN/mvwtDb+aVqkA7HYIwIj3ysfluPTorJnP6Ezx 198 | oHsD1s5ZXEktUwCOioB5f1CEPR9+wTG6iuiserTo8dkwng7HT/R+XUPF8xlcTjErAOdMcW6NW8STiwG8 199 | 7vej8oUPN/PsEv3t8Ao0TZP3T1u8uJRkUgAuSYHtO97oLxmXd5t9Ho8aPTK+GzntqNfrLm2fFoihwYOI 200 | xGIF4KjoGBLzY1OrF9k6OOFxnwDC4wxIMX1G0pMhgVyMNyoA13PAtS7OrJk1PrC69LUdQWxuF6IybHrX 201 | LRI7JrtZdoDAo1XmbjMyD+tjSXxGcXRmnYg5ttD9QuxDhN0uUgDOmbvNTpPOJaGAo2K36cyaGZvOFIfd 202 | KlSA8/zRh9ABIDUG+1JpAAAAAElFTkSuQmCC 203 | 204 | 205 | 206 | 84, 22 207 | 208 | 209 | Copy as text 210 | 211 | 212 | 213 | iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAYAAAAf8/9hAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 214 | YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIISURBVDhPpZP7S1NxGMbPPxKaXVUkMEq8IpKUCoY/hGgI 215 | ymqkDYYXcCjDZOANURSjCNGFQUTsl4GXVMxKk62YU4fXQpaIlygHQxBRH8/zwvyaIAYe+HLgnPN8nue9 216 | HA3nvDTq63oW/jm13XOwvPTB3DYFY5MH+bXfcN8ygfTSMSSXfESicQDxBqdYHwH29g9w2tnZ3UcguIvN 217 | rR3417exuBJE5N1n/wfwLgXEOc38Bc6xNRHb+/y4nm49G0Bnit2zf9H6bkliE/jKuYxrd6oVgDWfjB+K 218 | TWeKMyrGEVfowITvD9re/9ABVQrAhh0HHK+ZselMMaN/mvwtDb+aVqkA7HYIwIj3ysfluPTorJnP6Ezx 219 | oHsD1s5ZXEktUwCOioB5f1CEPR9+wTG6iuiserTo8dkwng7HT/R+XUPF8xlcTjErAOdMcW6NW8STiwG8 220 | 7vej8oUPN/PsEv3t8Ao0TZP3T1u8uJRkUgAuSYHtO97oLxmXd5t9Ho8aPTK+GzntqNfrLm2fFoihwYOI 221 | xGIF4KjoGBLzY1OrF9k6OOFxnwDC4wxIMX1G0pMhgVyMNyoA13PAtS7OrJk1PrC69LUdQWxuF6IybHrX 222 | LRI7JrtZdoDAo1XmbjMyD+tjSXxGcXRmnYg5ttD9QuxDhN0uUgDOmbvNTpPOJaGAo2K36cyaGZvOFIfd 223 | KlSA8/zRh9ABIDUG+1JpAAAAAElFTkSuQmCC 224 | 225 | 226 | 227 | 84, 22 228 | 229 | 230 | Copy as RTF 231 | 232 | 233 | Edit RTF 234 | 235 | 236 | RTF DOM V1.0 237 | 238 | -------------------------------------------------------------------------------- /Source/RtfDomParser.sln: -------------------------------------------------------------------------------- 1 |  2 | Microsoft Visual Studio Solution File, Format Version 12.00 3 | # Visual Studio 14 4 | VisualStudioVersion = 14.0.23107.0 5 | MinimumVisualStudioVersion = 10.0.40219.1 6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RtfDomParser", "RtfDomParser\RtfDomParser.csproj", "{D35F9B37-CF93-48AE-9A1A-3A99930F04FB}" 7 | EndProject 8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RtfDomParser.WinFormsDemo", "RtfDomParser.WinFormsDemo\RtfDomParser.WinFormsDemo.csproj", "{E91ECAF1-8270-4BD2-8517-5F28DF5B8058}" 9 | EndProject 10 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RtfDomParser.Tests", "RtfDomParser.Tests\RtfDomParser.Tests.csproj", "{C2283E51-A105-4FF3-96B4-C77DAC45F2E4}" 11 | EndProject 12 | Global 13 | GlobalSection(SolutionConfigurationPlatforms) = preSolution 14 | Debug|Any CPU = Debug|Any CPU 15 | Release|Any CPU = Release|Any CPU 16 | EndGlobalSection 17 | GlobalSection(ProjectConfigurationPlatforms) = postSolution 18 | {D35F9B37-CF93-48AE-9A1A-3A99930F04FB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 19 | {D35F9B37-CF93-48AE-9A1A-3A99930F04FB}.Debug|Any CPU.Build.0 = Debug|Any CPU 20 | {D35F9B37-CF93-48AE-9A1A-3A99930F04FB}.Release|Any CPU.ActiveCfg = Release|Any CPU 21 | {D35F9B37-CF93-48AE-9A1A-3A99930F04FB}.Release|Any CPU.Build.0 = Release|Any CPU 22 | {E91ECAF1-8270-4BD2-8517-5F28DF5B8058}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 23 | {E91ECAF1-8270-4BD2-8517-5F28DF5B8058}.Debug|Any CPU.Build.0 = Debug|Any CPU 24 | {E91ECAF1-8270-4BD2-8517-5F28DF5B8058}.Release|Any CPU.ActiveCfg = Release|Any CPU 25 | {E91ECAF1-8270-4BD2-8517-5F28DF5B8058}.Release|Any CPU.Build.0 = Release|Any CPU 26 | {C2283E51-A105-4FF3-96B4-C77DAC45F2E4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU 27 | {C2283E51-A105-4FF3-96B4-C77DAC45F2E4}.Debug|Any CPU.Build.0 = Debug|Any CPU 28 | {C2283E51-A105-4FF3-96B4-C77DAC45F2E4}.Release|Any CPU.ActiveCfg = Release|Any CPU 29 | {C2283E51-A105-4FF3-96B4-C77DAC45F2E4}.Release|Any CPU.Build.0 = Release|Any CPU 30 | EndGlobalSection 31 | GlobalSection(SolutionProperties) = preSolution 32 | HideSolutionNode = FALSE 33 | EndGlobalSection 34 | EndGlobal 35 | -------------------------------------------------------------------------------- /Source/RtfDomParser/ByteBuffer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | using System; 11 | 12 | namespace RtfDomParser 13 | { 14 | /// 15 | /// Binary data buffer 16 | /// 17 | public class ByteBuffer 18 | { 19 | /// 20 | /// Initialize instance 21 | /// 22 | public ByteBuffer() 23 | { 24 | } 25 | 26 | /// 27 | /// Current contains validate bytes 28 | /// 29 | protected int intCount = 0 ; 30 | /// 31 | /// byte array 32 | /// 33 | protected byte[] bsBuffer = new byte[ 16 ]; 34 | 35 | /// 36 | /// Clear object's data 37 | /// 38 | public virtual void Clear() 39 | { 40 | bsBuffer = new byte[ 16 ]; 41 | intCount = 0 ; 42 | } 43 | 44 | /// 45 | /// Reset current position without clear buffer 46 | /// 47 | public void Reset() 48 | { 49 | intCount = 0 ; 50 | } 51 | 52 | /// 53 | /// Set of get byte at special index which starts with 0 54 | /// 55 | public byte this[ int index ] 56 | { 57 | get 58 | { 59 | if( index >= 0 && index < intCount ) 60 | return bsBuffer[ index ] ; 61 | else 62 | throw new IndexOutOfRangeException("index"); 63 | } 64 | set 65 | { 66 | if( index >= 0 && index < intCount ) 67 | bsBuffer[ index ] = value ; 68 | else 69 | throw new IndexOutOfRangeException("index"); 70 | } 71 | } 72 | /// 73 | /// Validate bytes count 74 | /// 75 | public virtual int Count 76 | { 77 | get 78 | { 79 | return intCount; 80 | } 81 | } 82 | 83 | /// 84 | /// Add a byte 85 | /// 86 | /// byte data 87 | public void Add( byte b ) 88 | { 89 | FixBuffer( intCount + 1 ); 90 | bsBuffer[intCount] = b ; 91 | intCount ++; 92 | } 93 | 94 | /// 95 | /// Add bytes 96 | /// 97 | /// bytes 98 | public void Add( byte[] bs ) 99 | { 100 | if( bs != null) 101 | Add( bs , 0 , bs.Length ); 102 | } 103 | /// 104 | /// Add bytes 105 | /// 106 | /// Bytes 107 | /// Start index 108 | /// Length 109 | public void Add(byte[] bs , int StartIndex , int Length ) 110 | { 111 | if( bs != null && StartIndex >= 0 && (StartIndex + Length ) <= bs.Length && Length > 0 ) 112 | { 113 | FixBuffer(intCount + Length ); 114 | Array.Copy(bs , StartIndex , bsBuffer , intCount , Length ); 115 | intCount += Length ; 116 | } 117 | } 118 | 119 | /// 120 | /// Get validate bytes array 121 | /// 122 | /// bytes array 123 | public byte[] ToArray() 124 | { 125 | if( intCount > 0 ) 126 | { 127 | byte[] bs = new byte[ intCount ]; 128 | Array.Copy( bsBuffer , 0 , bs , 0 , intCount ); 129 | return bs ; 130 | } 131 | else 132 | return null; 133 | } 134 | 135 | /// 136 | /// Convert bytes data to a string 137 | /// 138 | /// string encoding 139 | /// string data 140 | public string GetString( System.Text.Encoding encoding ) 141 | { 142 | if( encoding == null ) 143 | throw new System.ArgumentNullException("encoding"); 144 | if( intCount > 0 ) 145 | return encoding.GetString( bsBuffer , 0 , intCount ); 146 | else 147 | return ""; 148 | } 149 | /// 150 | /// Fix inner buffer so it can fit to new size of buffer 151 | /// 152 | /// new size 153 | protected void FixBuffer( int NewSize ) 154 | { 155 | if( NewSize <= bsBuffer.Length ) 156 | return ; 157 | if( NewSize < (int)( bsBuffer.Length * 1.5 )) 158 | NewSize = (int)( bsBuffer.Length * 1.5 ); 159 | 160 | byte[] bs = new byte[ NewSize ]; 161 | Buffer.BlockCopy( bsBuffer , 0 , bs , 0 , bsBuffer.Length ); 162 | //Array.Copy( bsBuffer , 0 , bs , 0 , bsBuffer.Length ); 163 | bsBuffer = bs ; 164 | } 165 | } 166 | } -------------------------------------------------------------------------------- /Source/RtfDomParser/Defaults.cs: -------------------------------------------------------------------------------- 1 | using System.Text; 2 | 3 | namespace RtfDomParser 4 | { 5 | public static class Defaults 6 | { 7 | public static string FontName { get; set; } = "Times New Roman"; 8 | 9 | public static void LoadEncodings() 10 | { 11 | Encoding.RegisterProvider(CodePagesEncodingProvider.Instance); 12 | } 13 | } 14 | } -------------------------------------------------------------------------------- /Source/RtfDomParser/DocumentFormatInfo.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SourceCodeBackup/RtfDomParser/b7277305198a1d88754ee364cfbfdea044ef1ff7/Source/RtfDomParser/DocumentFormatInfo.cs -------------------------------------------------------------------------------- /Source/RtfDomParser/LevelNumberType.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace RtfDomParser 6 | { 7 | public enum LevelNumberType 8 | { 9 | None = -10, 10 | /// Arabic (1, 2, 3) 11 | Arabic = 0 , 12 | /// Uppercase Roman numeral (I, II, III) 13 | Uppercase_Roman_numeral = 1 , 14 | /// Lowercase Roman numeral (i, ii, iii) 15 | Lowercase_Roman_numeral = 2 , 16 | /// Uppercase letter (A, B, C) 17 | Uppercase_letter = 3 , 18 | /// Lowercase letter (a, b, c) 19 | Lowercase_letter = 4 , 20 | /// Ordinal number (1st, 2nd, 3rd) 21 | Ordinal_number = 5 , 22 | /// Cardinal text number (One, Two Three) 23 | Cardinal_text_number = 6 , 24 | /// Ordinal text number (First, Second, Third) 25 | Ordinal_text_number = 7 , 26 | /// Kanji numbering without the digit character (*dbnum1) 27 | Kanji_numbering_without_the_digit_character = 10 , 28 | /// Kanji numbering with the digit character (*dbnum2) 29 | Kanji_numbering_with_the_digit_characte = 11 , 30 | /// 46 phonetic katakana characters in "aiueo" order (*aiueo) 31 | _46_phonetic_katakana_characters_in_aiueo_order = 12 , 32 | /// 46 phonetic katakana characters in "iroha" order (*iroha) 33 | _46_phonetic_katakana_characters_in_iroha_order = 13 , 34 | /// Double_byte character 35 | Double_byte_character = 14 , 36 | /// Single_byte character 37 | Single_byte_character = 15 , 38 | /// Kanji numbering 3 (*dbnum3) 39 | Kanji_numbering_3 = 16 , 40 | /// Kanji numbering 4 (*dbnum4) 41 | Kanji_numbering_4 = 17 , 42 | /// Circle numbering (*circlenum) 43 | Circle_numbering = 18 , 44 | /// Double_byte Arabic numbering 45 | Double_byte_Arabic_numbering = 19 , 46 | /// 46 phonetic double_byte katakana characters (*aiueo*dbchar) 47 | _46_phonetic_double_byte_katakana_characters_aiueo_dbchar = 20 , 48 | /// 46 phonetic double_byte katakana characters (*iroha*dbchar) 49 | _46_phonetic_double_byte_katakana_characters_iroha_dbchar = 21 , 50 | /// Arabic with leading zero (01, 02, 03, ..., 10, 11) 51 | Arabic_with_leading_zero = 22 , 52 | /// Bullet (no number at all) 53 | Bullet = 23 , 54 | /// Korean numbering 2 (*ganada) 55 | Korean_numbering_2 = 24 , 56 | /// Korean numbering 1 (*chosung) 57 | Korean_numbering_1 = 25 , 58 | /// Chinese numbering 1 (*gb1) 59 | Chinese_numbering_1 = 26 , 60 | /// Chinese numbering 2 (*gb2) 61 | Chinese_numbering_2 = 27 , 62 | /// Chinese numbering 3 (*gb3) 63 | Chinese_numbering_3 = 28 , 64 | /// Chinese numbering 4 (*gb4) 65 | Chinese_numbering_4 = 29 , 66 | /// Chinese Zodiac numbering 1 (* zodiac1) 67 | Chinese_Zodiac_numbering_1 = 30 , 68 | /// Chinese Zodiac numbering 2 (* zodiac2) 69 | Chinese_Zodiac_numbering_2 = 31 , 70 | /// Chinese Zodiac numbering 3 (* zodiac3) 71 | Chinese_Zodiac_numbering_3 = 32 , 72 | /// Taiwanese double_byte numbering 1 73 | Taiwanese_double_byte_numbering_1 = 33 , 74 | /// Taiwanese double_byte numbering 2 75 | Taiwanese_double_byte_numbering_2 = 34 , 76 | /// Taiwanese double_byte numbering 3 77 | Taiwanese_double_byte_numbering_3 = 35 , 78 | /// Taiwanese double_byte numbering 4 79 | Taiwanese_double_byte_numbering_4 = 36 , 80 | /// Chinese double_byte numbering 1 81 | Chinese_double_byte_numbering_1 = 37 , 82 | /// Chinese double_byte numbering 2 83 | Chinese_double_byte_numbering_2 = 38 , 84 | /// Chinese double_byte numbering 3 85 | Chinese_double_byte_numbering_3 = 39 , 86 | /// Chinese double_byte numbering 4 87 | Chinese_double_byte_numbering_4 = 40 , 88 | /// Korean double_byte numbering 1 89 | Korean_double_byte_numbering_1 = 41 , 90 | /// Korean double_byte numbering 2 91 | Korean_double_byte_numbering_2 = 42 , 92 | /// Korean double_byte numbering 3 93 | Korean_double_byte_numbering_3 = 43 , 94 | /// Korean double_byte numbering 4 95 | Korean_double_byte_numbering_4 = 44 , 96 | /// Hebrew non_standard decimal 97 | Hebrew_non_standard_decimal_ = 45 , 98 | /// Arabic Alif Ba Tah 99 | Arabic_Alif_Ba_Tah = 46 , 100 | /// Hebrew Biblical standard 101 | Hebrew_Biblical_standard = 47 , 102 | /// Arabic Abjad style 103 | Arabic_Abjad_style = 48 , 104 | /// No number 105 | No_number = 255 106 | } 107 | } 108 | -------------------------------------------------------------------------------- /Source/RtfDomParser/ProgressEventHandler.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | using System; 11 | using System.Text; 12 | 13 | namespace RtfDomParser 14 | { 15 | /// 16 | /// progress event handler type 17 | /// 18 | /// sender 19 | /// event arguments 20 | public delegate void ProgressEventHandler( object sender , ProgressEventArgs args ); 21 | 22 | /// 23 | /// porgress event arguments 24 | /// 25 | public class ProgressEventArgs : EventArgs 26 | { 27 | public ProgressEventArgs(int max, int Value, string message) 28 | { 29 | intMaxValue = max; 30 | intValue = Value; 31 | strMessage = message; 32 | } 33 | 34 | private int intMaxValue = 0; 35 | /// 36 | /// progress max value 37 | /// 38 | public int MaxValue 39 | { 40 | get 41 | { 42 | return intMaxValue; 43 | } 44 | } 45 | 46 | private int intValue = 0; 47 | /// 48 | /// current value 49 | /// 50 | public int Value 51 | { 52 | get 53 | { 54 | return intValue; 55 | } 56 | } 57 | 58 | private string strMessage = null; 59 | /// 60 | /// progress message 61 | /// 62 | public string Message 63 | { 64 | get 65 | { 66 | return strMessage; 67 | } 68 | } 69 | 70 | private bool bolCancel = false; 71 | /// 72 | /// cancel operation 73 | /// 74 | public bool Cancel 75 | { 76 | get 77 | { 78 | return bolCancel; 79 | } 80 | set 81 | { 82 | bolCancel = value; 83 | } 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /Source/RtfDomParser/Properties/AssemblyInfo.cs: -------------------------------------------------------------------------------- 1 | using System.Reflection; 2 | using System.Runtime.CompilerServices; 3 | using System.Runtime.InteropServices; 4 | 5 | [assembly: AssemblyTitle("RTFDomParser")] 6 | [assembly: AssemblyDescription("Author : yuans , contact : yyf9989@hotmail.com , site : http://www.sinoreport.net")] 7 | [assembly: AssemblyConfiguration("")] 8 | [assembly: AssemblyProduct("RTFDomParser")] 9 | [assembly: AssemblyCopyright("")] 10 | [assembly: AssemblyTrademark("")] 11 | [assembly: AssemblyCulture("")] 12 | 13 | [assembly: ComVisible(false)] 14 | 15 | [assembly: Guid("62eb6bd0-e6c4-4a35-8afc-82fb2bf43a26")] 16 | 17 | [assembly: AssemblyVersion("1.0.0.*")] 18 | //[assembly: AssemblyFileVersion("1.0.0.0")] 19 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFAlignment.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | 12 | using System; 13 | using System.Text; 14 | 15 | namespace RtfDomParser 16 | { 17 | /// 18 | /// text alignment 19 | /// 20 | public enum RTFAlignment 21 | { 22 | /// 23 | /// left 24 | /// 25 | Left, 26 | /// 27 | /// center 28 | /// 29 | Center, 30 | /// 31 | /// right 32 | /// 33 | Right, 34 | /// 35 | /// justify 36 | /// 37 | Justify 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFAttribute.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | 12 | using System; 13 | using System.Text; 14 | 15 | namespace RtfDomParser 16 | { 17 | /// 18 | /// rtf attribute 19 | /// 20 | [Serializable()] 21 | public class RTFAttribute 22 | { 23 | /// 24 | /// initialize instance 25 | /// 26 | public RTFAttribute() 27 | { 28 | } 29 | 30 | private string strName = null; 31 | /// 32 | /// attribute's name 33 | /// 34 | [System.ComponentModel.DefaultValue( null)] 35 | public string Name 36 | { 37 | get 38 | { 39 | return strName; 40 | } 41 | set 42 | { 43 | strName = value; 44 | } 45 | } 46 | 47 | private int intValue = int.MinValue ; 48 | /// 49 | /// value 50 | /// 51 | [System.ComponentModel.DefaultValue( int.MinValue )] 52 | public int Value 53 | { 54 | get 55 | { 56 | return intValue; 57 | } 58 | set 59 | { 60 | intValue = value; 61 | } 62 | } 63 | public override string ToString() 64 | { 65 | return strName + "=" + intValue; 66 | } 67 | } 68 | 69 | /// 70 | /// RTF attribute list 71 | /// 72 | [Serializable()] 73 | [System.Diagnostics.DebuggerTypeProxy(typeof(RTFInstanceDebugView))] 74 | public class RTFAttributeList : System.Collections.CollectionBase 75 | { 76 | /// 77 | /// initialize instance 78 | /// 79 | public RTFAttributeList() 80 | { 81 | } 82 | 83 | public RTFAttribute GetItem(int index) 84 | { 85 | return (RTFAttribute)this.List[index]; 86 | } 87 | 88 | public int this[string name] 89 | { 90 | get 91 | { 92 | foreach (RTFAttribute a in this) 93 | { 94 | if (a.Name == name) 95 | return a.Value; 96 | } 97 | return int.MinValue; 98 | } 99 | set 100 | { 101 | foreach (RTFAttribute a in this) 102 | { 103 | if (a.Name == name) 104 | { 105 | a.Value = value; 106 | return; 107 | } 108 | } 109 | RTFAttribute item = new RTFAttribute(); 110 | item.Name = name; 111 | item.Value = value; 112 | this.List.Add(item); 113 | } 114 | } 115 | 116 | public int Add(RTFAttribute item) 117 | { 118 | return this.List.Add(item); 119 | } 120 | 121 | public int Add(string name, int v) 122 | { 123 | RTFAttribute item = new RTFAttribute(); 124 | item.Name = name; 125 | item.Value = v; 126 | return this.List.Add(item); 127 | } 128 | 129 | public void Remove(RTFAttribute item) 130 | { 131 | this.List.Remove(item); 132 | } 133 | 134 | public void Remove(string name) 135 | { 136 | for (int iCount = this.Count - 1; iCount >= 0; iCount--) 137 | { 138 | RTFAttribute item = (RTFAttribute)this.List[iCount]; 139 | if (item.Name == name) 140 | { 141 | this.List.RemoveAt(iCount); 142 | } 143 | } 144 | } 145 | 146 | public bool Contains(RTFAttribute item) 147 | { 148 | return this.List.Contains(item); 149 | } 150 | 151 | public bool Contains(string name) 152 | { 153 | foreach (RTFAttribute a in this) 154 | { 155 | if (a.Name == name) 156 | return true; 157 | } 158 | return false; 159 | } 160 | 161 | public RTFAttributeList Clone() 162 | { 163 | RTFAttributeList list = new RTFAttributeList(); 164 | foreach (RTFAttribute item in this) 165 | { 166 | RTFAttribute newItem = new RTFAttribute(); 167 | newItem.Name = item.Name; 168 | newItem.Value = item.Value; 169 | list.List.Add(newItem); 170 | } 171 | return list; 172 | } 173 | } 174 | } 175 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFBorderStyle.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Text; 13 | using System.Drawing ; 14 | using System.Drawing.Drawing2D; 15 | using System.ComponentModel; 16 | 17 | namespace RtfDomParser 18 | { 19 | public class RTFBorderStyle 20 | { 21 | private bool _Left = false; 22 | [DefaultValue( false )] 23 | public bool Left 24 | { 25 | get { return _Left; } 26 | set { _Left = value; } 27 | } 28 | 29 | private bool _Top = false; 30 | [DefaultValue(false)] 31 | public bool Top 32 | { 33 | get { return _Top; } 34 | set { _Top = value; } 35 | } 36 | 37 | private bool _Right = false; 38 | [DefaultValue(false)] 39 | public bool Right 40 | { 41 | get { return _Right; } 42 | set { _Right = value; } 43 | } 44 | 45 | private bool _Bottom = false; 46 | [DefaultValue(false)] 47 | public bool Bottom 48 | { 49 | get { return _Bottom; } 50 | set { _Bottom = value; } 51 | } 52 | 53 | private DashStyle _Style = DashStyle.Solid; 54 | [DefaultValue(DashStyle.Solid)] 55 | public DashStyle Style 56 | { 57 | get { return _Style; } 58 | set { _Style = value; } 59 | } 60 | 61 | private Color _Color = Color.Black; 62 | [DefaultValue(typeof( Color ) , "Black")] 63 | public Color Color 64 | { 65 | get { return _Color; } 66 | set { _Color = value; } 67 | } 68 | 69 | private bool _Thickness = false; 70 | /// 71 | /// 粗边框样式 72 | /// 73 | [DefaultValue( false)] 74 | public bool Thickness 75 | { 76 | get { return _Thickness; } 77 | set { _Thickness = value; } 78 | } 79 | /// 80 | /// 复制对象 81 | /// 82 | /// 复制品 83 | public RTFBorderStyle Clone() 84 | { 85 | RTFBorderStyle b = new RTFBorderStyle(); 86 | b._Bottom = this._Bottom; 87 | b._Color = this._Color; 88 | b._Left = this._Left; 89 | b._Right = this._Right; 90 | b._Style = this._Style; 91 | b._Top = this._Top; 92 | b._Thickness = this._Thickness; 93 | return b; 94 | } 95 | 96 | public bool EqualsValue(RTFBorderStyle b) 97 | { 98 | if (b == this) 99 | { 100 | return true; 101 | } 102 | if (b == null) 103 | { 104 | return false; 105 | } 106 | if (b._Bottom != this._Bottom 107 | || b._Color != this._Color 108 | || b._Left != this._Left 109 | || b._Right != this._Right 110 | || b._Style != this._Style 111 | || b._Top != this._Top 112 | || b._Thickness != this._Thickness ) 113 | { 114 | return false; 115 | } 116 | else 117 | { 118 | return true; 119 | } 120 | } 121 | } 122 | } 123 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFColorTable.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SourceCodeBackup/RtfDomParser/b7277305198a1d88754ee364cfbfdea044ef1ff7/Source/RtfDomParser/RTFColorTable.cs -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFConsts.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | using System; 11 | 12 | namespace RtfDomParser 13 | { 14 | /// 15 | /// Define some rtf key word 16 | /// 17 | public sealed class RTFConsts 18 | { 19 | public const string _insrsid = "insrsid"; 20 | public const string _af = "af"; 21 | public const string _rtf = "rtf"; 22 | public const string _fonttbl = "fonttbl"; 23 | public const string _docfmt = "docfmt"; 24 | public const string _info = "info"; 25 | public const string _author = "author"; 26 | public const string _creatim = "creatim"; 27 | public const string _version = "version"; 28 | public const string _colortbl = "colortbl"; 29 | public const string _b = "b"; 30 | public const string _blue = "blue"; 31 | //public const string _brdrb = "brdrb"; 32 | public const string _ansi = "ansi"; 33 | public const string _ansicpg = "ansicpg"; 34 | public const string _mac = "mac"; 35 | public const string _pc = "pc"; 36 | public const string _pca = "pca"; 37 | 38 | public const string _fnil = "fnil"; 39 | public const string _froman = "froman"; 40 | public const string _fswiss = "fswiss"; 41 | public const string _fmodern = "fmodern"; 42 | public const string _fscript = "fscript"; 43 | public const string _fdecor = "fdecor"; 44 | public const string _ftech = "ftech"; 45 | public const string _fbidi = "fbidi"; 46 | public const string _fcharset = "fcharset"; 47 | public const string _generator = "generator"; 48 | public const string _xmlns = "xmlns"; 49 | public const string _header = "header"; 50 | public const string _footer = "footer"; 51 | public const string _headerl = "headerl"; 52 | public const string _headerr = "headerr"; 53 | public const string _headerf = "headerf"; 54 | public const string _footerl = "footerl"; 55 | public const string _footerr = "footerr"; 56 | public const string _footerf = "footerf"; 57 | public const string _headery = "headery"; 58 | public const string _footery = "footery"; 59 | public const string _stylesheet = "stylesheet"; 60 | public const string _filetbl = "filetbl"; 61 | public const string _listtable = "listtable"; 62 | public const string _listoverride = "listoverride"; 63 | public const string _revtbl = "revtbl"; 64 | public const string _nonshppict = "nonshppict"; 65 | public const string _pntext = "pntext"; 66 | public const string _pntxtb = "pntxtb"; 67 | public const string _pntxta = "pntxta"; 68 | public const string _paperw = "paperw"; 69 | public const string _paperh = "paperh"; 70 | public const string _margl = "margl"; 71 | public const string _margr = "margr"; 72 | public const string _margb = "margb"; 73 | public const string _margt = "margt"; 74 | public const string _landscape = "landscape"; 75 | //public const string _header = "header"; 76 | //public const string _footer = "footer"; 77 | public const string _pard = "pard"; 78 | public const string _page = "page"; 79 | public const string _pagebb = "pagebb"; 80 | public const string _par = "par"; 81 | public const string _ql = "ql"; 82 | public const string _qc = "qc"; 83 | public const string _qr = "qr"; 84 | public const string _qj = "qj"; 85 | public const string _fi = "fi"; 86 | public const string _sl = "sl"; 87 | public const string _slmult = "slmult"; 88 | public const string _sb = "sb"; 89 | public const string _sa = "sa"; 90 | public const string _pn = "pn"; 91 | public const string _pnlvlbody = "pnlvlbody"; 92 | public const string _pnlvlblt = "pnlvlblt"; 93 | public const string _listtext = "listtext"; 94 | public const string _ls = "ls"; 95 | public const string _li = "li"; 96 | public const string _line = "line"; 97 | public const string _plain = "plain"; 98 | public const string _f = "f"; 99 | public const string _fs = "fs"; 100 | public const string _cf = "cf"; 101 | public const string _cb = "cb"; 102 | public const string _chcbpat = "chcbpat"; 103 | public const string _i = "i"; 104 | public const string _u = "u"; 105 | public const string _v = "v"; 106 | public const string _highlight = "highlight"; 107 | public const string _ul = "ul"; 108 | public const string _noul = "ulnone"; 109 | public const string _strike = "strike"; 110 | public const string _sub = "sub"; 111 | public const string _super = "super"; 112 | public const string _nosupersub = "nosupersub"; 113 | public const string _bkmkstart = "bkmkstart"; 114 | public const string _bkmkend = "bkmkend"; 115 | public const string _field = "field"; 116 | public const string _flddirty = "flddirty"; 117 | public const string _fldedit = "fldedit"; 118 | public const string _fldlock = "fldlock"; 119 | public const string _fldpriv = "fldpriv"; 120 | public const string _fldinst = "fldinst"; 121 | public const string _fldrslt = "fldrslt"; 122 | public const string _HYPERLINK = "HYPERLINK"; 123 | public const string _blipuid = "blipuid"; 124 | public const string _emfblip = "emfblip"; 125 | public const string _pngblip = "pngblip"; 126 | public const string _jpegblip = "jpegblip"; 127 | public const string _macpict = "macpict"; 128 | public const string _pmmetafile = "pmmetafile"; 129 | public const string _wmetafile = "wmetafile"; 130 | public const string _dibitmap = "dibitmap"; 131 | public const string _wbitmap = "wbitmap"; 132 | public const string _shppict = "shppict"; 133 | public const string _pict = "pict"; 134 | public const string _picscalex = "picscalex"; 135 | public const string _picscaley = "picscaley"; 136 | public const string _picwgoal = "picwgoal"; 137 | public const string _pichgoal = "pichgoal"; 138 | public const string _intbl = "intbl"; 139 | public const string _trowd = "trowd"; 140 | public const string _itap = "itap"; 141 | public const string _nesttableprops = "nesttableprops"; 142 | public const string _nestrow = "nestrow"; 143 | public const string _row = "row"; 144 | 145 | public const string _irowband = "irowband"; 146 | public const string _trautofit = "trautofit"; 147 | public const string _trkeepfollow = "trkeepfollow"; 148 | public const string _trqc = "trqc"; 149 | public const string _trql = "trql"; 150 | public const string _trqr = "trqr"; 151 | public const string _trhdr = "trhdr"; 152 | public const string _trrh = "trrh"; 153 | public const string _trkeep = "trkeep"; 154 | public const string _trleft = "trleft"; 155 | public const string _trcbpat = "trcbpat"; 156 | public const string _trcfpat = "trcfpat"; 157 | public const string _trpat = "trpat"; 158 | public const string _trshdng = "trshdng"; 159 | public const string _trwWidth = "trwWidth"; 160 | public const string _trwWidthA = "trwWidthA"; 161 | public const string _irow = "irow"; 162 | public const string _trpaddb = "trpaddb"; 163 | public const string _trpaddl = "trpaddl"; 164 | public const string _trpaddr = "trpaddr"; 165 | public const string _trpaddt = "trpaddt"; 166 | public const string _trpaddfb = "trpaddfb"; 167 | public const string _trpaddfl = "trpaddfl"; 168 | public const string _trpaddfr = "trpaddfr"; 169 | public const string _trpaddft = "trpaddft"; 170 | 171 | public const string _clvmgf = "clvmgf"; 172 | public const string _clvmrg = "clvmrg"; 173 | public const string _cellx = "cellx"; 174 | public const string _clvertalt = "clvertalt"; 175 | public const string _clvertalc = "clvertalc"; 176 | public const string _clvertalb = "clvertalb"; 177 | public const string _clNoWrap = "clNoWrap"; 178 | public const string _clcbpat = "clcbpat"; 179 | public const string _clcfpat = "clcfpat"; 180 | public const string _clpadl = "clpadl"; 181 | public const string _clpadt = "clpadt"; 182 | public const string _clpadr = "clpadr"; 183 | public const string _clpadb = "clpadb"; 184 | public const string _clbrdrl = "clbrdrl"; 185 | public const string _clbrdrt = "clbrdrt"; 186 | public const string _clbrdrr = "clbrdrr"; 187 | public const string _clbrdrb = "clbrdrb"; 188 | public const string _cell = "cell"; 189 | public const string _nestcell = "nestcell"; 190 | public const string _lastrow = "lastrow"; 191 | public const string _brdrt = "brdrt"; 192 | public const string _brdrb = "brdrb"; 193 | public const string _brdrl = "brdrl"; 194 | public const string _brdrr = "brdrr"; 195 | public const string _brdrw = "brdrw"; 196 | public const string _brdrcf = "brdrcf"; 197 | public const string _brdrs = "brdrs"; 198 | public const string _brdrth = "brdrth"; 199 | public const string _brdrdot = "brdrdot"; 200 | public const string _brdrdash = "brdrdash"; 201 | public const string _brdrdashsm = "brdrdashsm"; 202 | public const string _brdrdashd = "brdrdashd"; 203 | public const string _brdrdashdd = "brdrdashdd"; 204 | public const string _chbrdr = "chbrdr"; 205 | public const string _brdrnil = "brdrnil"; 206 | public const string _brdrtbl = "brdrtbl"; 207 | public const string _brdrnone = "brdrnone"; 208 | public const string _brsp = "brsp"; 209 | public const string _nonesttables = "nonesttables"; 210 | 211 | public const string _object = "object"; 212 | public const string _objemb = "objemb"; 213 | public const string _objlink = "objlink"; 214 | public const string _objautlink = "objautlink"; 215 | public const string _objsub = "objsub"; 216 | public const string _objpub = "objpub"; 217 | public const string _objicemb = "objicemb"; 218 | public const string _objhtml = "objhtml"; 219 | public const string _objocx = "objocx"; 220 | public const string _objclass = "objclass"; 221 | public const string _objname = "objname"; 222 | public const string _objtime = "objtime"; 223 | public const string _objh = "objh"; 224 | public const string _objw = "objw"; 225 | public const string _objsetsize = "objsetsize"; 226 | public const string _objdata = "objdata"; 227 | public const string _objalias = "objalias"; 228 | public const string _objsect = "objsect"; 229 | public const string _objscalex = "objscalex"; 230 | public const string _objscaley = "objscaley"; 231 | public const string _result = "result"; 232 | 233 | public const string _shp = "shp"; 234 | public const string _shpleft = "shpleft"; 235 | public const string _shptop = "shptop"; 236 | public const string _shpbottom = "shpbottom"; 237 | public const string _shpright = "shpright"; 238 | public const string _shplid = "shplid"; 239 | public const string _shpz = "shpz"; 240 | public const string _shptxt = "shptxt"; 241 | public const string _shpgrp = "shpgrp"; 242 | public const string _background = "background"; 243 | public const string _shprslt = "shprslt"; 244 | public const string _shpinst = "shpinst"; 245 | public const string _sp = "sp"; 246 | public const string _sn = "sn"; 247 | public const string _sv = "sv"; 248 | public const string _xmlopen = "xmlopen"; 249 | 250 | public const string _fchars = "fchars"; 251 | public const string _lchars = "lchars"; 252 | 253 | 254 | private RTFConsts() 255 | { 256 | } 257 | } 258 | } 259 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDocumentInfo.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | using System; 12 | 13 | namespace RtfDomParser 14 | { 15 | /// 16 | /// Document information 17 | /// 18 | [Serializable()] 19 | [System.Diagnostics.DebuggerTypeProxy(typeof(RTFInstanceDebugView))] 20 | public class RTFDocumentInfo 21 | { 22 | private System.Collections.Specialized.StringDictionary myInfo = 23 | new System.Collections.Specialized.StringDictionary(); 24 | /// 25 | /// get information specify name 26 | /// 27 | /// name 28 | /// value 29 | public string GetInfo( string strName ) 30 | { 31 | return myInfo[ strName ] ; 32 | } 33 | 34 | /// 35 | /// set information specify name 36 | /// 37 | /// name 38 | /// value 39 | public void SetInfo( string strName , string strValue ) 40 | { 41 | myInfo[ strName ] = strValue ; 42 | } 43 | /// 44 | /// document title 45 | /// 46 | public string Title 47 | { 48 | get{ return myInfo["title"] ;} 49 | set{ myInfo["title"] = value;} 50 | } 51 | public string Subject 52 | { 53 | get{ return myInfo["subject"] ;} 54 | set{ myInfo["subject"] = value;} 55 | } 56 | public string Author 57 | { 58 | get{ return myInfo["author"] ;} 59 | set{ myInfo["author"] = value;} 60 | } 61 | public string Manager 62 | { 63 | get{ return myInfo["manager"] ;} 64 | set{ myInfo["manager"] = value;} 65 | } 66 | public string Company 67 | { 68 | get{ return myInfo["company"] ;} 69 | set{ myInfo["company"] = value;} 70 | } 71 | public string Operator 72 | { 73 | get{ return myInfo["operator"] ;} 74 | set{ myInfo["operator"] = value;} 75 | } 76 | public string Category 77 | { 78 | get{ return myInfo["category"] ;} 79 | set{ myInfo["categroy"] = value;} 80 | } 81 | public string Keywords 82 | { 83 | get{ return myInfo["keywords"] ;} 84 | set{ myInfo["keywords"] = value;} 85 | } 86 | public string Comment 87 | { 88 | get{ return myInfo["comment"] ;} 89 | set{ myInfo["comment"] = value;} 90 | } 91 | public string Doccomm 92 | { 93 | get{ return myInfo["doccomm"] ;} 94 | set{ myInfo["doccomm"] = value;} 95 | } 96 | public string HLinkbase 97 | { 98 | get{ return myInfo["hlinkbase"] ;} 99 | set{ myInfo["hlinkbase"] = value;} 100 | } 101 | 102 | /// 103 | /// total edit minutes 104 | /// 105 | public int edmins 106 | { 107 | get 108 | { 109 | if (myInfo.ContainsKey("edmins")) 110 | { 111 | string v = Convert.ToString(myInfo["edmins"]); 112 | int result = 0; 113 | if (int.TryParse(v, out result)) 114 | { 115 | return result; 116 | } 117 | } 118 | return 0; 119 | } 120 | set 121 | { 122 | myInfo["edmins"] = value.ToString(); 123 | } 124 | } 125 | 126 | /// 127 | /// version 128 | /// 129 | public string vern 130 | { 131 | get { return myInfo["vern"]; } 132 | set { myInfo["vern"] = value; } 133 | } 134 | 135 | /// 136 | /// number of pages 137 | /// 138 | public string nofpages 139 | { 140 | get { return myInfo["nofpages"]; } 141 | set { myInfo["nofpages"] = value; } 142 | } 143 | 144 | /// 145 | /// number of words 146 | /// 147 | public string nofwords 148 | { 149 | get { return myInfo["nofwords"]; } 150 | set { myInfo["nofwords"] = value; } 151 | } 152 | 153 | /// 154 | /// number of characters , include whitespace 155 | /// 156 | public string nofchars 157 | { 158 | get { return myInfo["nofchars"]; } 159 | set { myInfo["nofchars"] = value; } 160 | } 161 | 162 | /// 163 | /// number of characters , exclude white space 164 | /// 165 | public string nofcharsws 166 | { 167 | get { return myInfo["nofcharsws"]; } 168 | set { myInfo["nofcharsws"] = value; } 169 | } 170 | 171 | /// 172 | /// inner id 173 | /// 174 | public string id 175 | { 176 | get { return myInfo["id"]; } 177 | set { myInfo["id"] = value; } 178 | } 179 | 180 | private DateTime dtmCreatim = DateTime.Now ; 181 | /// 182 | /// creation time 183 | /// 184 | public DateTime Creatim 185 | { 186 | get{ return dtmCreatim ;} 187 | set{ dtmCreatim = value;} 188 | } 189 | 190 | private DateTime dtmRevtim = DateTime.Now ; 191 | /// 192 | /// modified time 193 | /// 194 | public DateTime Revtim 195 | { 196 | get{ return dtmRevtim ;} 197 | set{ dtmRevtim = value;} 198 | } 199 | 200 | private DateTime dtmPrintim = DateTime.Now ; 201 | /// 202 | /// last print time 203 | /// 204 | public DateTime Printim 205 | { 206 | get{ return dtmPrintim ;} 207 | set{ dtmPrintim = value;} 208 | } 209 | 210 | private DateTime dtmBuptim = DateTime.Now ; 211 | /// 212 | /// back up time 213 | /// 214 | public DateTime Buptim 215 | { 216 | get{ return dtmBuptim ;} 217 | set{ dtmBuptim = value;} 218 | } 219 | 220 | internal string[] StringItems 221 | { 222 | get 223 | { 224 | System.Collections.ArrayList list = new System.Collections.ArrayList(); 225 | foreach (string key in myInfo.Keys) 226 | { 227 | list.Add(key + "=" + myInfo[key]); 228 | } 229 | list.Add("Creatim="+this.Creatim.ToString("yyyy-MM-dd HH:mm:ss")); 230 | list.Add("Revtim="+ this.Revtim.ToString("yyyy-MM-dd HH:mm:ss")); 231 | list.Add("Printim="+ this.Printim.ToString("yyyy-MM-dd HH:mm:ss")); 232 | list.Add("Buptim="+ this.Buptim.ToString("yyyy-MM-dd HH:mm:ss")); 233 | return ( string[]) list.ToArray(typeof(string)); 234 | } 235 | } 236 | 237 | public void Clear() 238 | { 239 | myInfo.Clear(); 240 | dtmCreatim = System.DateTime.Now ; 241 | dtmRevtim = DateTime.Now ; 242 | dtmPrintim = DateTime.Now ; 243 | dtmBuptim = DateTime.Now ; 244 | } 245 | 246 | public void Write(RTFWriter writer) 247 | { 248 | writer.WriteStartGroup( ); 249 | writer.WriteKeyword("info"); 250 | foreach( string strKey in myInfo.Keys ) 251 | { 252 | writer.WriteStartGroup(); 253 | if (strKey == "edmins" 254 | || strKey == "vern" 255 | || strKey == "nofpages" 256 | || strKey == "nofwords" 257 | || strKey == "nofchars" 258 | || strKey == "nofcharsws" 259 | || strKey == "id") 260 | { 261 | writer.WriteKeyword(strKey + myInfo[strKey]); 262 | } 263 | else 264 | { 265 | writer.WriteKeyword(strKey); 266 | writer.WriteText(myInfo[strKey]); 267 | } 268 | writer.WriteEndGroup(); 269 | } 270 | writer.WriteStartGroup(); 271 | 272 | WriteTime( writer , "creatim" , dtmCreatim ); 273 | WriteTime( writer , "revtim" , dtmRevtim ); 274 | WriteTime( writer , "printim" , dtmPrintim ); 275 | WriteTime( writer , "buptim" , dtmBuptim ); 276 | 277 | writer.WriteEndGroup(); 278 | } 279 | 280 | private void WriteTime( RTFWriter writer , string name , DateTime Value ) 281 | { 282 | writer.WriteStartGroup(); 283 | writer.WriteKeyword( name ); 284 | writer.WriteKeyword( "yr" + Value.Year ); 285 | writer.WriteKeyword( "mo" + Value.Month ); 286 | writer.WriteKeyword( "dy" + Value.Day ); 287 | writer.WriteKeyword( "hr" + Value.Hour ); 288 | writer.WriteKeyword( "min" + Value.Minute ); 289 | writer.WriteKeyword( "sec" + Value.Second ); 290 | writer.WriteEndGroup(); 291 | } 292 | } 293 | } -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDocumentWriter.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SourceCodeBackup/RtfDomParser/b7277305198a1d88754ee364cfbfdea044ef1ff7/Source/RtfDomParser/RTFDocumentWriter.cs -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomBookmark.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | 12 | using System; 13 | using System.Text; 14 | 15 | namespace RtfDomParser 16 | { 17 | /// 18 | /// rtf bookmark 19 | /// 20 | [Serializable()] 21 | public class RTFDomBookmark : RTFDomElement 22 | { 23 | public RTFDomBookmark() 24 | { 25 | } 26 | 27 | private string strName = null; 28 | /// 29 | /// name 30 | /// 31 | [System.ComponentModel.DefaultValue( null )] 32 | public string Name 33 | { 34 | get 35 | { 36 | return strName; 37 | } 38 | set 39 | { 40 | strName = value; 41 | } 42 | } 43 | 44 | public override string ToString() 45 | { 46 | return "BookMark:" + strName; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomDocument.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SourceCodeBackup/RtfDomParser/b7277305198a1d88754ee364cfbfdea044ef1ff7/Source/RtfDomParser/RTFDomDocument.cs -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomElement.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | using System; 12 | using System.Text; 13 | using System.Collections; 14 | using System.ComponentModel; 15 | 16 | namespace RtfDomParser 17 | { 18 | /// 19 | /// RTF dom element 20 | /// 21 | /// this is the most base element type 22 | public abstract class RTFDomElement 23 | { 24 | private RTFAttributeList myAttributes = new RTFAttributeList(); 25 | /// 26 | /// RTF native attribute 27 | /// 28 | public RTFAttributeList Attributes 29 | { 30 | get 31 | { 32 | return myAttributes; 33 | } 34 | set 35 | { 36 | myAttributes = value; 37 | } 38 | } 39 | 40 | public bool HasAttribute(string name) 41 | { 42 | return myAttributes.Contains(name); 43 | } 44 | 45 | public int GetAttributeValue( string name , int defaultValue ) 46 | { 47 | if( myAttributes.Contains( name )) 48 | return myAttributes[ name ] ; 49 | else 50 | return defaultValue ; 51 | } 52 | 53 | private RTFDomElementList myElements = new RTFDomElementList(); 54 | /// 55 | /// child elements list 56 | /// 57 | public RTFDomElementList Elements 58 | { 59 | get 60 | { 61 | return myElements; 62 | } 63 | } 64 | 65 | private RTFDomDocument myOwnerDocument = null; 66 | /// 67 | /// the docuemnt which owned this element 68 | /// 69 | [System.ComponentModel.Browsable( false )] 70 | [System.Xml.Serialization.XmlIgnore()] 71 | public RTFDomDocument OwnerDocument 72 | { 73 | get 74 | { 75 | return myOwnerDocument; 76 | } 77 | set 78 | { 79 | myOwnerDocument = value; 80 | foreach (RTFDomElement element in this.Elements) 81 | { 82 | element.OwnerDocument = value; 83 | } 84 | } 85 | } 86 | /// 87 | /// append child element 88 | /// 89 | /// child element 90 | /// index of element 91 | public int AppendChild(RTFDomElement element) 92 | { 93 | CheckLocked(); 94 | element.myParent = this; 95 | element.OwnerDocument = this.myOwnerDocument; 96 | return myElements.Add(element); 97 | } 98 | 99 | /// 100 | /// set attribute 101 | /// 102 | /// name 103 | /// value 104 | public void SetAttribute(string name, int Value) 105 | { 106 | CheckLocked(); 107 | this.myAttributes[name] = Value; 108 | } 109 | 110 | private RTFDomElement myParent = null; 111 | /// 112 | /// parent element 113 | /// 114 | [System.ComponentModel.Browsable( false )] 115 | public RTFDomElement Parent 116 | { 117 | get 118 | { 119 | return myParent; 120 | } 121 | } 122 | 123 | [System.ComponentModel.Browsable( false )] 124 | public virtual string InnerText 125 | { 126 | get 127 | { 128 | StringBuilder str = new StringBuilder(); 129 | if (myElements != null) 130 | { 131 | foreach (RTFDomElement element in this.myElements) 132 | { 133 | str.Append(element.InnerText); 134 | } 135 | } 136 | return str.ToString(); 137 | } 138 | } 139 | 140 | 141 | private void CheckLocked() 142 | { 143 | if (bolLocked) 144 | { 145 | throw new InvalidOperationException("Element locked"); 146 | } 147 | } 148 | 149 | private bool bolLocked = false; 150 | /// 151 | /// Whether element is locked , if element is lock , it can not append chidl element 152 | /// 153 | [System.Xml.Serialization.XmlIgnore( )] 154 | [System.ComponentModel.Browsable( false )] 155 | public bool Locked 156 | { 157 | get 158 | { 159 | return bolLocked; 160 | } 161 | set 162 | { 163 | bolLocked = value; 164 | } 165 | } 166 | 167 | public void SetLockedDeeply( bool locked ) 168 | { 169 | this.bolLocked = locked; 170 | if (this.myElements != null) 171 | { 172 | foreach (RTFDomElement element in myElements) 173 | { 174 | element.SetLockedDeeply(locked); 175 | } 176 | } 177 | } 178 | 179 | public void PrintDomString() 180 | { 181 | System.Console.WriteLine(this.ToDomString()); 182 | } 183 | 184 | public virtual string ToDomString() 185 | { 186 | System.Text.StringBuilder builder = new StringBuilder(); 187 | builder.Append(this.ToString()); 188 | ToDomString(this.Elements, builder, 1); 189 | return builder.ToString(); 190 | } 191 | 192 | protected void ToDomString(RTFDomElementList elements, System.Text.StringBuilder builder, int level) 193 | { 194 | foreach (RTFDomElement element in elements) 195 | { 196 | builder.Append(Environment.NewLine); 197 | builder.Append( new string( ' ' , level * 4 )); 198 | builder.Append(element.ToString()); 199 | ToDomString(element.Elements, builder, level + 1); 200 | } 201 | } 202 | 203 | /// 204 | /// Native level in RTF document 205 | /// 206 | [NonSerialized()] 207 | internal int NativeLevel = -1; 208 | } 209 | } 210 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomElementContainer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | using System; 11 | using System.Text; 12 | 13 | namespace RtfDomParser 14 | { 15 | /// 16 | /// RTF element container 17 | /// 18 | [Serializable()] 19 | public class RTFDomElementContainer : RTFDomElement 20 | { 21 | /// 22 | /// initialize instance 23 | /// 24 | public RTFDomElementContainer() 25 | { 26 | } 27 | private string strName = null; 28 | /// 29 | /// name 30 | /// 31 | [System.ComponentModel.DefaultValue( null )] 32 | public string Name 33 | { 34 | get 35 | { 36 | return strName; 37 | } 38 | set 39 | { 40 | strName = value; 41 | } 42 | } 43 | 44 | public override string ToString() 45 | { 46 | return "Container : " + strName; 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomElementList.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | 12 | using System; 13 | using System.Text; 14 | 15 | namespace RtfDomParser 16 | { 17 | /// 18 | /// RTF element's list 19 | /// 20 | [Serializable()] 21 | [System.Diagnostics.DebuggerTypeProxy(typeof(RTFInstanceDebugView))] 22 | public class RTFDomElementList : System.Collections.CollectionBase 23 | { 24 | /// 25 | /// initialize instance 26 | /// 27 | public RTFDomElementList() 28 | { 29 | } 30 | 31 | /// 32 | /// get the element at special index 33 | /// 34 | /// index 35 | /// element 36 | public RTFDomElement this[int index] 37 | { 38 | get 39 | { 40 | return (RTFDomElement)this.List[index]; 41 | } 42 | } 43 | 44 | /// 45 | /// get the last element in the list 46 | /// 47 | public RTFDomElement LastElement 48 | { 49 | get 50 | { 51 | if (this.Count > 0) 52 | return (RTFDomElement)this.List[this.Count - 1]; 53 | else 54 | return null; 55 | } 56 | } 57 | /// 58 | /// add element 59 | /// 60 | /// element 61 | /// index 62 | public int Add(RTFDomElement element ) 63 | { 64 | return this.List.Add( element ); 65 | } 66 | /// 67 | /// insert element 68 | /// 69 | /// special index 70 | /// element 71 | public void Insert(int index, RTFDomElement element) 72 | { 73 | this.List.Insert(index, element); 74 | } 75 | /// 76 | /// Get the index of special element that starts with 0. 77 | /// 78 | /// element 79 | /// index , if not find element , then return -1 80 | public int IndexOf(RTFDomElement element) 81 | { 82 | return this.List.IndexOf(element); 83 | } 84 | /// 85 | /// delete element 86 | /// 87 | /// element 88 | public void Remove(RTFDomElement node) 89 | { 90 | this.List.Remove(node); 91 | } 92 | /// 93 | /// return element array 94 | /// 95 | /// array 96 | public RTFDomElement[] ToArray() 97 | { 98 | return (RTFDomElement[])this.InnerList.ToArray(typeof(RTFDomElement)); 99 | } 100 | } 101 | } 102 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomField.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | using System; 12 | using System.Text; 13 | 14 | namespace RtfDomParser 15 | { 16 | /// 17 | /// document field element 18 | /// 19 | [Serializable()] 20 | public class RTFDomField : RTFDomElement 21 | { 22 | /// 23 | /// initialize instance 24 | /// 25 | public RTFDomField() 26 | { 27 | } 28 | 29 | private RTFDomFieldMethod intMethod = RTFDomFieldMethod.None; 30 | /// 31 | /// method 32 | /// 33 | [System.ComponentModel.DefaultValue(RTFDomFieldMethod.None)] 34 | public RTFDomFieldMethod Method 35 | { 36 | get 37 | { 38 | return intMethod; 39 | } 40 | set 41 | { 42 | intMethod = value; 43 | } 44 | } 45 | 46 | //private string strInstructions = null; 47 | /// 48 | /// instructions 49 | /// 50 | [System.ComponentModel.DefaultValue(null)] 51 | public string Instructions 52 | { 53 | get 54 | { 55 | foreach (RTFDomElement element in this.Elements) 56 | { 57 | if (element is RTFDomElementContainer) 58 | { 59 | RTFDomElementContainer c = (RTFDomElementContainer)element; 60 | if (c.Name == RTFConsts._fldinst) 61 | { 62 | return c.InnerText; 63 | } 64 | } 65 | } 66 | return null ; 67 | } 68 | //set 69 | //{ 70 | // strInstructions = value; 71 | //} 72 | } 73 | 74 | /// 75 | /// result 76 | /// 77 | [System.ComponentModel.DefaultValue(null)] 78 | public RTFDomElementContainer Result 79 | { 80 | get 81 | { 82 | foreach (RTFDomElement element in this.Elements) 83 | { 84 | if (element is RTFDomElementContainer) 85 | { 86 | RTFDomElementContainer c = (RTFDomElementContainer)element; 87 | if (c.Name == RTFConsts._fldrslt) 88 | { 89 | return c; 90 | } 91 | } 92 | } 93 | return null; 94 | } 95 | //set 96 | //{ 97 | // strResult = value; 98 | //} 99 | } 100 | 101 | public string ResultString 102 | { 103 | get 104 | { 105 | RTFDomElementContainer c = this.Result; 106 | if (c != null) 107 | { 108 | return c.InnerText; 109 | } 110 | else 111 | { 112 | return null; 113 | } 114 | } 115 | } 116 | public override string ToString() 117 | { 118 | return "Field";// +strInstructions + " Result:" + this.ResultString; 119 | } 120 | 121 | }//public class RTFDomField : RTFDomElement 122 | 123 | 124 | public enum RTFDomFieldMethod 125 | { 126 | None, 127 | Dirty, 128 | Edit, 129 | Lock, 130 | Priv, 131 | } 132 | 133 | } 134 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomHeader.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Text; 13 | 14 | namespace RtfDomParser 15 | { 16 | /// 17 | /// 页眉元素 18 | /// 19 | [Serializable()] 20 | public class RTFDomHeader : RTFDomElement 21 | { 22 | private HeaderFooterStyle _Style = HeaderFooterStyle.AllPages; 23 | /// 24 | /// 页眉页脚样式 25 | /// 26 | [System.ComponentModel.DefaultValue( HeaderFooterStyle.AllPages )] 27 | public HeaderFooterStyle Style 28 | { 29 | get 30 | { 31 | return _Style; 32 | } 33 | set 34 | { 35 | _Style = value; 36 | } 37 | } 38 | public override string ToString() 39 | { 40 | return "Header " + this.Style; 41 | } 42 | 43 | /// 44 | /// 判断元素是否有实际内容 45 | /// 46 | public bool HasContentElement 47 | { 48 | get 49 | { 50 | return RTFUtil.HasContentElement(this); 51 | } 52 | } 53 | } 54 | 55 | /// 56 | /// 页脚元素 57 | /// 58 | [Serializable()] 59 | public class RTFDomFooter : RTFDomElement 60 | { 61 | private HeaderFooterStyle _Style = HeaderFooterStyle.AllPages; 62 | /// 63 | /// 页眉页脚样式 64 | /// 65 | [System.ComponentModel.DefaultValue(HeaderFooterStyle.AllPages)] 66 | public HeaderFooterStyle Style 67 | { 68 | get 69 | { 70 | return _Style; 71 | } 72 | set 73 | { 74 | _Style = value; 75 | } 76 | } 77 | 78 | 79 | /// 80 | /// 判断元素是否有实际内容 81 | /// 82 | public bool HasContentElement 83 | { 84 | get 85 | { 86 | return RTFUtil.HasContentElement(this); 87 | } 88 | } 89 | 90 | public override string ToString() 91 | { 92 | return "Footer " + this.Style; 93 | } 94 | } 95 | 96 | public enum HeaderFooterStyle 97 | { 98 | AllPages , 99 | LeftPages , 100 | RightPages , 101 | FirstPage 102 | } 103 | } 104 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomImage.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SourceCodeBackup/RtfDomParser/b7277305198a1d88754ee364cfbfdea044ef1ff7/Source/RtfDomParser/RTFDomImage.cs -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomLineBreak.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | 12 | using System; 13 | using System.Text; 14 | 15 | namespace RtfDomParser 16 | { 17 | /// 18 | /// line element 19 | /// 20 | [Serializable()] 21 | public class RTFDomLineBreak : RTFDomElement 22 | { 23 | /// 24 | /// initialize instance 25 | /// 26 | public RTFDomLineBreak() 27 | { 28 | this.Locked = true; 29 | } 30 | 31 | public override string InnerText 32 | { 33 | get 34 | { 35 | return Environment.NewLine; 36 | } 37 | } 38 | public override string ToString() 39 | { 40 | return "linebreak"; 41 | } 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomObject.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Text; 13 | 14 | namespace RtfDomParser 15 | { 16 | /// 17 | /// 内嵌对象 18 | /// 19 | [Serializable] 20 | public class RTFDomObject : RTFDomElement 21 | { 22 | /// 23 | /// 初始化对象 24 | /// 25 | public RTFDomObject() 26 | { 27 | } 28 | 29 | private Dictionary _CustomAttributes = new Dictionary(); 30 | /// 31 | /// 用户自定义的属性列表 32 | /// 33 | public Dictionary CustomAttributes 34 | { 35 | get 36 | { 37 | if (_CustomAttributes == null) 38 | { 39 | _CustomAttributes = new Dictionary(); 40 | } 41 | return _CustomAttributes; 42 | } 43 | set 44 | { 45 | _CustomAttributes = value; 46 | } 47 | } 48 | 49 | //private Dictionary _Attributes = new Dictionary(); 50 | ///// 51 | ///// 自定义的属性列表 52 | ///// 53 | //public Dictionary Attributes1 54 | //{ 55 | // get 56 | // { 57 | // if (_Attributes == null) 58 | // { 59 | // _Attributes = new Dictionary(); 60 | // } 61 | // return _Attributes; 62 | // } 63 | // set 64 | // { 65 | // _Attributes = value; 66 | // } 67 | //} 68 | 69 | private RTFObjectType _Type = RTFObjectType.EMB; 70 | /// 71 | /// 对象类型 72 | /// 73 | public RTFObjectType Type 74 | { 75 | get { return _Type; } 76 | set { _Type = value; } 77 | } 78 | 79 | private string _ClassName = null; 80 | /// 81 | /// 类型名称 82 | /// 83 | public string ClassName 84 | { 85 | get { return _ClassName; } 86 | set { _ClassName = value; } 87 | } 88 | 89 | private string _Name = null; 90 | /// 91 | /// 名称 92 | /// 93 | public string Name 94 | { 95 | get { return _Name; } 96 | set { _Name = value; } 97 | } 98 | 99 | private byte[] _Content = null; 100 | /// 101 | /// 对象二进制内容 102 | /// 103 | public byte[] Content 104 | { 105 | get { return _Content; } 106 | set { _Content = value; } 107 | } 108 | 109 | /// 110 | /// 文本格式的内容 111 | /// 112 | [System.ComponentModel.Browsable( false )] 113 | public string ContentText 114 | { 115 | get 116 | { 117 | if (_Content == null || _Content.Length == 0) 118 | { 119 | return null; 120 | } 121 | else 122 | { 123 | return System.Text.Encoding.Default.GetString(_Content); 124 | } 125 | } 126 | } 127 | 128 | private int _Width = 0; 129 | /// 130 | /// 宽度 131 | /// 132 | public int Width 133 | { 134 | get { return _Width; } 135 | set { _Width = value; } 136 | } 137 | 138 | private int _Height = 0; 139 | /// 140 | /// 高度 141 | /// 142 | public int Height 143 | { 144 | get { return _Height; } 145 | set { _Height = value; } 146 | } 147 | 148 | private int _ScaleX = 100; 149 | 150 | public int ScaleX 151 | { 152 | get { return _ScaleX; } 153 | set { _ScaleX = value; } 154 | } 155 | 156 | private int _ScaleY = 100; 157 | 158 | public int ScaleY 159 | { 160 | get { return _ScaleY; } 161 | set { _ScaleY = value; } 162 | } 163 | 164 | public override string ToString() 165 | { 166 | string txt = "Object:" + this.Width + "*" + this.Height; 167 | if (_Content != null && _Content.Length > 0) 168 | { 169 | txt = txt + " " + Convert.ToDouble(_Content.Length / 1024.0).ToString("0.00") + "KB"; 170 | } 171 | return txt; 172 | } 173 | 174 | /// 175 | /// result 176 | /// 177 | [System.ComponentModel.DefaultValue(null)] 178 | public RTFDomElementContainer Result 179 | { 180 | get 181 | { 182 | foreach (RTFDomElement element in this.Elements) 183 | { 184 | if (element is RTFDomElementContainer) 185 | { 186 | RTFDomElementContainer c = (RTFDomElementContainer)element; 187 | if (c.Name == RTFConsts._result) 188 | { 189 | return c; 190 | } 191 | } 192 | } 193 | return null; 194 | } 195 | //set 196 | //{ 197 | // strResult = value; 198 | //} 199 | } 200 | 201 | 202 | } 203 | 204 | public enum RTFObjectType 205 | { 206 | EMB , 207 | Link, 208 | AutLink , 209 | Sub , 210 | Pub , 211 | Icemb, 212 | Html, 213 | Ocx 214 | } 215 | } 216 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomPageBreak.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Text; 13 | 14 | namespace RtfDomParser 15 | { 16 | /// 17 | /// 强制分页符 18 | /// 19 | [Serializable()] 20 | public class RTFDomPageBreak:RTFDomElement 21 | { 22 | /// 23 | /// 初始化对象 24 | /// 25 | public RTFDomPageBreak() 26 | { 27 | //对象不能有子元素 28 | this.Locked = true; 29 | } 30 | 31 | public override string InnerText 32 | { 33 | get 34 | { 35 | return ""; 36 | } 37 | } 38 | public override string ToString() 39 | { 40 | return "page"; 41 | } 42 | } 43 | 44 | 45 | } 46 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomParagraph.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SourceCodeBackup/RtfDomParser/b7277305198a1d88754ee364cfbfdea044ef1ff7/Source/RtfDomParser/RTFDomParagraph.cs -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomShape.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | 12 | using System; 13 | using System.Text; 14 | using System.ComponentModel ; 15 | 16 | namespace RtfDomParser 17 | { 18 | /// 19 | /// shape element 20 | /// 21 | [Serializable()] 22 | public class RTFDomShape : RTFDomElement 23 | { 24 | /// 25 | /// initialize instance 26 | /// 27 | public RTFDomShape() 28 | { 29 | } 30 | 31 | private int intLeft = 0; 32 | /// 33 | /// left position 34 | /// 35 | [DefaultValue( 0 )] 36 | public int Left 37 | { 38 | get 39 | { 40 | return intLeft; 41 | } 42 | set 43 | { 44 | intLeft = value; 45 | } 46 | } 47 | 48 | private int intTop = 0; 49 | /// 50 | /// top position 51 | /// 52 | [DefaultValue( 0 )] 53 | public int Top 54 | { 55 | get 56 | { 57 | return intTop; 58 | } 59 | set 60 | { 61 | intTop = value; 62 | } 63 | } 64 | 65 | private int intWidth = 0; 66 | /// 67 | /// width 68 | /// 84 | /// height 85 | /// 86 | [DefaultValue(0)] 87 | public int Height 88 | { 89 | get 90 | { 91 | return intHeight; 92 | } 93 | set 94 | { 95 | intHeight = value; 96 | } 97 | } 98 | 99 | private int intZIndex = 0; 100 | /// 101 | /// Z index 102 | /// 103 | [DefaultValue(0)] 104 | public int ZIndex 105 | { 106 | get 107 | { 108 | return intZIndex; 109 | } 110 | set 111 | { 112 | intZIndex = value; 113 | } 114 | } 115 | 116 | private int intShapeID = 0; 117 | /// 118 | /// shape id 119 | /// 120 | [DefaultValue(0)] 121 | public int ShapeID 122 | { 123 | get 124 | { 125 | return intShapeID; 126 | } 127 | set 128 | { 129 | intShapeID = value; 130 | } 131 | } 132 | 133 | private StringAttributeCollection myExtAttrbutes = new StringAttributeCollection(); 134 | /// 135 | /// ext attribute 136 | /// 137 | public StringAttributeCollection ExtAttrbutes 138 | { 139 | get 140 | { 141 | return myExtAttrbutes; 142 | } 143 | set 144 | { 145 | myExtAttrbutes = value; 146 | } 147 | } 148 | 149 | public override string ToString() 150 | { 151 | return "Shape:Left:" + intLeft + " Top:" + intTop + " Width:" + intWidth + " Height:" + intHeight; 152 | } 153 | } 154 | } 155 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomShapeGroup.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | 12 | using System; 13 | using System.Text; 14 | 15 | namespace RtfDomParser 16 | { 17 | /// 18 | /// shape group 19 | /// 20 | [Serializable()] 21 | public class RTFDomShapeGroup : RTFDomElement 22 | { 23 | /// 24 | /// initialize instance 25 | /// 26 | public RTFDomShapeGroup() 27 | { 28 | } 29 | 30 | private StringAttributeCollection myExtAttrbutes = new StringAttributeCollection(); 31 | /// 32 | /// extern attributes 33 | /// 34 | public StringAttributeCollection ExtAttrbutes 35 | { 36 | get 37 | { 38 | return myExtAttrbutes; 39 | } 40 | set 41 | { 42 | myExtAttrbutes = value; 43 | } 44 | } 45 | 46 | public override string ToString() 47 | { 48 | return "ShapeGroup"; 49 | } 50 | } 51 | } 52 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomTable.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | using System; 12 | using System.Text; 13 | 14 | namespace RtfDomParser 15 | { 16 | /// 17 | /// table 18 | /// 19 | [Serializable()] 20 | public class RTFDomTable : RTFDomElement 21 | { 22 | /// 23 | /// initialize instance 24 | /// 25 | public RTFDomTable() 26 | { 27 | } 28 | 29 | private RTFDomElementList myColumns = new RTFDomElementList(); 30 | /// 31 | /// column list 32 | /// 33 | public RTFDomElementList Columns 34 | { 35 | get 36 | { 37 | return myColumns; 38 | } 39 | set 40 | { 41 | myColumns = value; 42 | } 43 | } 44 | 45 | public override string ToString() 46 | { 47 | return "Table(Rows:" + this.Elements.Count + " Columns:" + myColumns.Count + ")"; 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomTableCell.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | 12 | using System; 13 | using System.Text; 14 | 15 | namespace RtfDomParser 16 | { 17 | /// 18 | /// cell 19 | /// 20 | [Serializable()] 21 | public class RTFDomTableCell : RTFDomElement 22 | { 23 | /// 24 | /// initialize instance 25 | /// 26 | public RTFDomTableCell() 27 | { 28 | myFormat.BorderWidth = 1; 29 | } 30 | 31 | private int intRowSpan = 1; 32 | /// 33 | /// row span 34 | /// 35 | [System.ComponentModel.DefaultValue(1)] 36 | public int RowSpan 37 | { 38 | get 39 | { 40 | return intRowSpan; 41 | } 42 | set 43 | { 44 | intRowSpan = value; 45 | } 46 | } 47 | 48 | private int intColSpan = 1; 49 | /// 50 | /// col span 51 | /// 52 | [System.ComponentModel.DefaultValue(1)] 53 | public int ColSpan 54 | { 55 | get 56 | { 57 | return intColSpan; 58 | } 59 | set 60 | { 61 | intColSpan = value; 62 | } 63 | } 64 | 65 | private int intPaddingLeft = int.MinValue; 66 | /// 67 | /// left padding 68 | /// 69 | [System.ComponentModel.DefaultValue(int.MinValue)] 70 | public int PaddingLeft 71 | { 72 | get 73 | { 74 | return intPaddingLeft; 75 | } 76 | set 77 | { 78 | intPaddingLeft = value; 79 | } 80 | } 81 | 82 | /// 83 | /// left padding in fact 84 | /// 85 | [System.ComponentModel.Browsable(false)] 86 | [System.Xml.Serialization.XmlIgnore()] 87 | public int RuntimePaddingLeft 88 | { 89 | get 90 | { 91 | if (intPaddingLeft != int.MinValue) 92 | { 93 | return intPaddingLeft; 94 | } 95 | else if (this.Parent != null) 96 | { 97 | int p = ((RTFDomTableRow)this.Parent).PaddingLeft; 98 | if (p != int.MinValue) 99 | { 100 | return p; 101 | } 102 | } 103 | return 0; 104 | } 105 | } 106 | 107 | private int intPaddingTop = int.MinValue; 108 | /// 109 | /// top padding 110 | /// 111 | [System.ComponentModel.DefaultValue(int.MinValue)] 112 | public int PaddingTop 113 | { 114 | get 115 | { 116 | return intPaddingTop; 117 | } 118 | set 119 | { 120 | intPaddingTop = value; 121 | } 122 | } 123 | 124 | /// 125 | /// top padding in fact 126 | /// 127 | [System.ComponentModel.Browsable(false)] 128 | [System.Xml.Serialization.XmlIgnore()] 129 | public int RuntimePaddingTop 130 | { 131 | get 132 | { 133 | if (intPaddingTop != int.MinValue) 134 | { 135 | return intPaddingTop; 136 | } 137 | else if (this.Parent != null) 138 | { 139 | int p = ((RTFDomTableRow)this.Parent).PaddingTop; 140 | if (p != int.MinValue) 141 | { 142 | return p; 143 | } 144 | } 145 | return 0; 146 | } 147 | } 148 | 149 | private int intPaddingRight = int.MinValue; 150 | /// 151 | /// right padding 152 | /// 153 | [System.ComponentModel.DefaultValue(int.MinValue)] 154 | public int PaddingRight 155 | { 156 | get 157 | { 158 | return intPaddingRight; 159 | } 160 | set 161 | { 162 | intPaddingRight = value; 163 | } 164 | } 165 | 166 | /// 167 | /// right padding in fact 168 | /// 169 | [System.ComponentModel.Browsable(false)] 170 | [System.Xml.Serialization.XmlIgnore()] 171 | public int RuntimePaddingRight 172 | { 173 | get 174 | { 175 | if (intPaddingRight != int.MinValue) 176 | { 177 | return intPaddingRight; 178 | } 179 | else if (this.Parent != null) 180 | { 181 | int p = ((RTFDomTableRow)this.Parent).PaddingRight; 182 | if (p != int.MinValue) 183 | { 184 | return p; 185 | } 186 | } 187 | return 0; 188 | } 189 | } 190 | 191 | private int intPaddingBottom = int.MinValue; 192 | /// 193 | /// bottom padding 194 | /// 195 | [System.ComponentModel.DefaultValue(int.MinValue)] 196 | public int PaddingBottom 197 | { 198 | get 199 | { 200 | return intPaddingBottom; 201 | } 202 | set 203 | { 204 | intPaddingBottom = value; 205 | } 206 | } 207 | 208 | /// 209 | /// bottom padding in fact 210 | /// 211 | [System.ComponentModel.Browsable(false)] 212 | [System.Xml.Serialization.XmlIgnore()] 213 | public int RuntimePaddingBottom 214 | { 215 | get 216 | { 217 | if (intPaddingBottom != int.MinValue) 218 | { 219 | return intPaddingBottom; 220 | } 221 | else if (this.Parent != null) 222 | { 223 | int p = ((RTFDomTableRow)this.Parent).PaddingBottom; 224 | if (p != int.MinValue) 225 | { 226 | return p; 227 | } 228 | } 229 | return 0; 230 | } 231 | } 232 | 233 | //private bool bolLeftBorder = false; 234 | //[System.ComponentModel.DefaultValue(false)] 235 | //public bool LeftBorder 236 | //{ 237 | // get 238 | // { 239 | // return bolLeftBorder; 240 | // } 241 | // set 242 | // { 243 | // bolLeftBorder = value; 244 | // } 245 | //} 246 | 247 | //private bool bolTopBorder = false; 248 | //[System.ComponentModel.DefaultValue(false)] 249 | //public bool TopBorder 250 | //{ 251 | // get 252 | // { 253 | // return bolTopBorder; 254 | // } 255 | // set 256 | // { 257 | // bolTopBorder = value; 258 | // } 259 | //} 260 | 261 | 262 | //private bool bolRightBorder = false; 263 | //[System.ComponentModel.DefaultValue(false)] 264 | //public bool RightBorder 265 | //{ 266 | // get 267 | // { 268 | // return bolRightBorder; 269 | // } 270 | // set 271 | // { 272 | // bolRightBorder = value; 273 | // } 274 | //} 275 | 276 | //private bool bolBottomBorder = false; 277 | 278 | //[System.ComponentModel.DefaultValue(false)] 279 | //public bool BottomBorder 280 | //{ 281 | // get 282 | // { 283 | // return bolBottomBorder; 284 | // } 285 | // set 286 | // { 287 | // bolBottomBorder = value; 288 | // } 289 | //} 290 | 291 | private RTFVerticalAlignment intVerticalAlignment = RTFVerticalAlignment.Top; 292 | /// 293 | /// vertial alignment 294 | /// 295 | [System.ComponentModel.DefaultValue(RTFVerticalAlignment.Top)] 296 | public RTFVerticalAlignment VerticalAlignment 297 | { 298 | get 299 | { 300 | return intVerticalAlignment; 301 | } 302 | set 303 | { 304 | intVerticalAlignment = value; 305 | } 306 | } 307 | 308 | private DocumentFormatInfo myFormat = new DocumentFormatInfo(); 309 | /// 310 | /// format 311 | /// 312 | public DocumentFormatInfo Format 313 | { 314 | get 315 | { 316 | return myFormat; 317 | } 318 | set 319 | { 320 | myFormat = value; 321 | } 322 | } 323 | 324 | private bool bolMultiline = true; 325 | /// 326 | /// allow multiline 327 | /// 328 | [System.ComponentModel.DefaultValue(false)] 329 | public bool Multiline 330 | { 331 | get 332 | { 333 | return bolMultiline; 334 | } 335 | set 336 | { 337 | bolMultiline = value; 338 | } 339 | } 340 | 341 | //private System.Drawing.Color intBorderColor = System.Drawing.Color.Black; 342 | ///// 343 | ///// border color 344 | ///// 345 | //[System.ComponentModel.DefaultValue(typeof(System.Drawing.Color), "Black")] 346 | //public System.Drawing.Color BorderColor 347 | //{ 348 | // get 349 | // { 350 | // return intBorderColor; 351 | // } 352 | // set 353 | // { 354 | // intBorderColor = value; 355 | // } 356 | //} 357 | 358 | //private System.Drawing.Color intBackColor = System.Drawing.Color.Transparent; 359 | ///// 360 | ///// back color 361 | ///// 362 | //[System.ComponentModel.DefaultValue(typeof(System.Drawing.Color), "Transparent")] 363 | //public System.Drawing.Color BackColor 364 | //{ 365 | // get 366 | // { 367 | // return intBackColor; 368 | // } 369 | // set 370 | // { 371 | // intBackColor = value; 372 | // } 373 | //} 374 | 375 | 376 | private int intLeft = 0; 377 | /// 378 | /// left position 379 | /// 380 | [System.ComponentModel.DefaultValue(0)] 381 | public int Left 382 | { 383 | get 384 | { 385 | return intLeft; 386 | } 387 | set 388 | { 389 | intLeft = value; 390 | } 391 | } 392 | 393 | private int intWidth = 0; 394 | /// 395 | /// width 396 | /// 397 | [System.ComponentModel.DefaultValue( 0 )] 398 | public int Width 399 | { 400 | get 401 | { 402 | return intWidth; 403 | } 404 | set 405 | { 406 | intWidth = value; 407 | } 408 | } 409 | 410 | private int intHeight = 0; 411 | /// 412 | /// height 413 | /// 414 | [System.ComponentModel.DefaultValue(0)] 415 | public int Height 416 | { 417 | get 418 | { 419 | return intHeight; 420 | } 421 | set 422 | { 423 | intHeight = value; 424 | } 425 | } 426 | 427 | private RTFDomTableCell myOverrideCell = null; 428 | /// 429 | /// this cell merged by another cell which this property specify 430 | /// 431 | [System.ComponentModel.Browsable( false )] 432 | [System.Xml.Serialization.XmlIgnore()] 433 | public RTFDomTableCell OverrideCell 434 | { 435 | get 436 | { 437 | return myOverrideCell; 438 | } 439 | set 440 | { 441 | myOverrideCell = value; 442 | } 443 | } 444 | 445 | public override string ToString() 446 | { 447 | if (myOverrideCell == null) 448 | { 449 | if (intRowSpan != 1 || intColSpan != 1) 450 | { 451 | return "Cell: RowSpan:" + intRowSpan + " ColSpan:" + intColSpan + " Width:" + this.Width ; 452 | } 453 | else 454 | { 455 | return "Cell:Width:" + this.Width ; 456 | } 457 | } 458 | else 459 | { 460 | return "Cell:Overrided"; 461 | } 462 | } 463 | } 464 | 465 | } 466 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomTableColumn.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | 12 | using System; 13 | using System.Text; 14 | 15 | namespace RtfDomParser 16 | { 17 | /// 18 | /// table column 19 | /// 20 | [Serializable()] 21 | public class RTFDomTableColumn : RTFDomElement 22 | { 23 | /// 24 | /// initialize instance 25 | /// 26 | public RTFDomTableColumn() 27 | { 28 | } 29 | 30 | private int intWidth = 0; 31 | /// 32 | /// width 33 | /// 34 | [System.ComponentModel.DefaultValue( 0 )] 35 | public int Width 36 | { 37 | get 38 | { 39 | return intWidth; 40 | } 41 | set 42 | { 43 | intWidth = value; 44 | } 45 | } 46 | 47 | public override string ToString() 48 | { 49 | return "Column"; 50 | } 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomTableRow.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | 12 | using System; 13 | using System.Text; 14 | using System.ComponentModel; 15 | using System.Collections; 16 | 17 | namespace RtfDomParser 18 | { 19 | /// 20 | /// table row 21 | /// 22 | [Serializable()] 23 | public class RTFDomTableRow : RTFDomElement 24 | { 25 | /// 26 | /// initialize instance 27 | /// 28 | public RTFDomTableRow() 29 | { 30 | } 31 | 32 | [NonSerialized()] 33 | private ArrayList myCellSettings = new ArrayList(); 34 | /// 35 | /// cell settings 36 | /// 37 | [Browsable( false )] 38 | [System.Xml.Serialization.XmlIgnore()] 39 | internal ArrayList CellSettings 40 | { 41 | get 42 | { 43 | return myCellSettings; 44 | } 45 | set 46 | { 47 | myCellSettings = value; 48 | } 49 | } 50 | 51 | private DocumentFormatInfo myFormat = new DocumentFormatInfo(); 52 | /// 53 | /// format 54 | /// 55 | public DocumentFormatInfo Format 56 | { 57 | get 58 | { 59 | return myFormat; 60 | } 61 | set 62 | { 63 | myFormat = value; 64 | } 65 | } 66 | 67 | private int intLevel = 1; 68 | /// 69 | /// document level 70 | /// 71 | [DefaultValue( 1 )] 72 | public int Level 73 | { 74 | get 75 | { 76 | return intLevel; 77 | } 78 | set 79 | { 80 | intLevel = value; 81 | } 82 | } 83 | 84 | private int intRowIndex = 0; 85 | /// 86 | /// row index 87 | /// 88 | [DefaultValue( 0 )] 89 | internal int RowIndex 90 | { 91 | get 92 | { 93 | return intRowIndex; 94 | } 95 | set 96 | { 97 | intRowIndex = value; 98 | } 99 | } 100 | 101 | private bool bolIsLastRow = false; 102 | /// 103 | /// is the last row 104 | /// 105 | [DefaultValue( false )] 106 | public bool IsLastRow 107 | { 108 | get 109 | { 110 | return bolIsLastRow; 111 | } 112 | set 113 | { 114 | bolIsLastRow = value; 115 | } 116 | } 117 | 118 | private bool bolHeader = false; 119 | /// 120 | /// is header row 121 | /// 122 | [DefaultValue( false )] 123 | public bool Header 124 | { 125 | get 126 | { 127 | return bolHeader; 128 | } 129 | set 130 | { 131 | bolHeader = value; 132 | } 133 | } 134 | 135 | 136 | private int intHeight = 0; 137 | /// 138 | /// height 139 | /// 140 | [System.ComponentModel.DefaultValue(0)] 141 | public int Height 142 | { 143 | get 144 | { 145 | return intHeight; 146 | } 147 | set 148 | { 149 | intHeight = value; 150 | } 151 | } 152 | 153 | 154 | private int intPaddingLeft = int.MinValue; 155 | /// 156 | /// padding left 157 | /// 158 | [System.ComponentModel.DefaultValue(int.MinValue)] 159 | public int PaddingLeft 160 | { 161 | get 162 | { 163 | return intPaddingLeft; 164 | } 165 | set 166 | { 167 | intPaddingLeft = value; 168 | } 169 | } 170 | 171 | private int intPaddingTop = int.MinValue; 172 | /// 173 | /// top padding 174 | /// 175 | [System.ComponentModel.DefaultValue(int.MinValue)] 176 | public int PaddingTop 177 | { 178 | get 179 | { 180 | return intPaddingTop; 181 | } 182 | set 183 | { 184 | intPaddingTop = value; 185 | } 186 | } 187 | 188 | 189 | 190 | private int intPaddingRight = int.MinValue; 191 | /// 192 | /// right padding 193 | /// 194 | [System.ComponentModel.DefaultValue(int.MinValue)] 195 | public int PaddingRight 196 | { 197 | get 198 | { 199 | return intPaddingRight; 200 | } 201 | set 202 | { 203 | intPaddingRight = value; 204 | } 205 | } 206 | 207 | private int intPaddingBottom = int.MinValue; 208 | /// 209 | /// bottom padding 210 | /// 211 | [System.ComponentModel.DefaultValue(int.MinValue)] 212 | public int PaddingBottom 213 | { 214 | get 215 | { 216 | return intPaddingBottom; 217 | } 218 | set 219 | { 220 | intPaddingBottom = value; 221 | } 222 | } 223 | 224 | private int intWidth = 0; 225 | /// 226 | /// width 227 | /// 228 | [DefaultValue( 0 )] 229 | public int Width 230 | { 231 | get 232 | { 233 | return intWidth; 234 | } 235 | set 236 | { 237 | intWidth = value; 238 | } 239 | } 240 | 241 | public override string ToString() 242 | { 243 | return "Row " + intRowIndex; 244 | } 245 | 246 | } 247 | } 248 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomTempContainer.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | using System; 11 | using System.Collections.Generic; 12 | using System.Text; 13 | 14 | namespace RtfDomParser 15 | { 16 | public class RTFDomTempContainer: RTFDomElement 17 | { 18 | 19 | public RTFDomTempContainer() 20 | { 21 | } 22 | 23 | private DocumentFormatInfo myFormat = new DocumentFormatInfo(); 24 | /// 25 | /// format 26 | /// 27 | public DocumentFormatInfo Format 28 | { 29 | get 30 | { 31 | return myFormat; 32 | } 33 | set 34 | { 35 | myFormat = value; 36 | } 37 | } 38 | 39 | public override string ToString() 40 | { 41 | return "TempContainer"; 42 | } 43 | 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFDomText.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | 12 | using System; 13 | using System.Text; 14 | 15 | namespace RtfDomParser 16 | { 17 | /// 18 | /// text element 19 | /// 20 | [Serializable()] 21 | public class RTFDomText : RTFDomElement 22 | { 23 | /// 24 | /// initialize instance 25 | /// 26 | public RTFDomText() 27 | { 28 | // text element can not contains any child element 29 | this.Locked = true; 30 | } 31 | 32 | private DocumentFormatInfo myFormat = new DocumentFormatInfo(); 33 | /// 34 | /// format 35 | /// 36 | public DocumentFormatInfo Format 37 | { 38 | get 39 | { 40 | return myFormat; 41 | } 42 | set 43 | { 44 | myFormat = value; 45 | } 46 | } 47 | 48 | private string strText = null; 49 | /// 50 | /// text 51 | /// 52 | [System.ComponentModel.DefaultValue( null)] 53 | public string Text 54 | { 55 | get 56 | { 57 | return strText; 58 | } 59 | set 60 | { 61 | strText = value; 62 | } 63 | } 64 | public override string InnerText 65 | { 66 | get 67 | { 68 | return strText; 69 | } 70 | } 71 | public override string ToString() 72 | { 73 | StringBuilder str = new StringBuilder(); 74 | str.Append("Text"); 75 | if (this.Format != null) 76 | { 77 | if (this.Format.Hidden) 78 | { 79 | str.Append("(Hidden)"); 80 | } 81 | } 82 | str.Append(":" + strText); 83 | return str.ToString(); 84 | } 85 | } 86 | } 87 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFFontTable.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SourceCodeBackup/RtfDomParser/b7277305198a1d88754ee364cfbfdea044ef1ff7/Source/RtfDomParser/RTFFontTable.cs -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFInstanceDebugView.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | using System; 12 | using System.Text; 13 | 14 | namespace RtfDomParser 15 | { 16 | /// 17 | /// debug information dispalyer at design time 18 | /// 19 | public class RTFInstanceDebugView 20 | { 21 | /// 22 | /// initialize instance 23 | /// 24 | /// 25 | public RTFInstanceDebugView(object instance) 26 | { 27 | if (instance == null) 28 | throw new ArgumentNullException("instance"); 29 | myInstance = instance; 30 | } 31 | 32 | private object myInstance = null; 33 | 34 | /// 35 | /// output debug item at design time 36 | /// 37 | [System.Diagnostics.DebuggerBrowsable(System.Diagnostics.DebuggerBrowsableState.RootHidden)] 38 | public object Items 39 | { 40 | get 41 | { 42 | if (myInstance is System.Collections.IEnumerable) 43 | { 44 | System.Collections.CollectionBase list = (System.Collections.CollectionBase)myInstance; 45 | object[] items = new object[list.Count]; 46 | int iCount = 0; 47 | foreach (object obj in list) 48 | { 49 | items[iCount] = obj; 50 | iCount++; 51 | } 52 | return items; 53 | } 54 | else if (myInstance is RTFColorTable) 55 | { 56 | RTFColorTable table = (RTFColorTable)myInstance; 57 | object[] items = new object[table.Count]; 58 | for (int iCount = 0; iCount < table.Count; iCount++) 59 | { 60 | items[iCount] = table[iCount]; 61 | } 62 | return items; 63 | } 64 | else if (myInstance is RTFDocumentInfo) 65 | { 66 | RTFDocumentInfo info = (RTFDocumentInfo)myInstance; 67 | return info.StringItems; 68 | } 69 | else 70 | { 71 | return myInstance; 72 | } 73 | } 74 | } 75 | } 76 | } 77 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFListOverrideTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace RtfDomParser 6 | { 7 | public class RTFListOverrideTable : List 8 | { 9 | public RTFListOverrideTable() 10 | { 11 | } 12 | 13 | public RTFListOverride GetByID(int id) 14 | { 15 | foreach (RTFListOverride item in this) 16 | { 17 | if (item.ID == id) 18 | { 19 | return item; 20 | } 21 | } 22 | return null; 23 | } 24 | } 25 | 26 | public class RTFListOverride 27 | { 28 | private int _ListID = 0; 29 | 30 | public int ListID 31 | { 32 | get { return _ListID; } 33 | set { _ListID = value; } 34 | } 35 | 36 | private int _ListOverriedCount = 0; 37 | 38 | public int ListOverriedCount 39 | { 40 | get { return _ListOverriedCount; } 41 | set { _ListOverriedCount = value; } 42 | } 43 | 44 | private int _ID = 1; 45 | 46 | public int ID 47 | { 48 | get { return _ID; } 49 | set { _ID = value; } 50 | } 51 | 52 | public override string ToString() 53 | { 54 | return "ID:" + this.ID + " ListID:" + this.ListID + " Count:" + this.ListOverriedCount; 55 | } 56 | } 57 | } 58 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFListTable.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace RtfDomParser 6 | { 7 | public class RTFListTable : List 8 | { 9 | public RTFListTable() 10 | { 11 | } 12 | 13 | public RTFList GetByID(int id) 14 | { 15 | foreach (RTFList list in this) 16 | { 17 | if (list.ListID == id) 18 | { 19 | return list; 20 | } 21 | } 22 | return null; 23 | } 24 | } 25 | 26 | public class RTFList 27 | { 28 | private int _ListID = 0; 29 | 30 | public int ListID 31 | { 32 | get { return _ListID; } 33 | set { _ListID = value; } 34 | } 35 | 36 | private int _ListTemplateID = 0; 37 | 38 | public int ListTemplateID 39 | { 40 | get { return _ListTemplateID; } 41 | set { _ListTemplateID = value; } 42 | } 43 | 44 | private bool _ListSimple = false; 45 | 46 | public bool ListSimple 47 | { 48 | get { return _ListSimple; } 49 | set { _ListSimple = value; } 50 | } 51 | 52 | private bool _ListHybrid = false; 53 | 54 | public bool ListHybrid 55 | { 56 | get { return _ListHybrid; } 57 | set { _ListHybrid = value; } 58 | } 59 | 60 | private string _ListName = null; 61 | 62 | public string ListName 63 | { 64 | get { return _ListName; } 65 | set { _ListName = value; } 66 | } 67 | 68 | private string _ListStyleName = null; 69 | 70 | public string ListStyleName 71 | { 72 | get { return _ListStyleName; } 73 | set { _ListStyleName = value; } 74 | } 75 | 76 | private int _LevelStartAt = 1; 77 | 78 | public int LevelStartAt 79 | { 80 | get { return _LevelStartAt; } 81 | set { _LevelStartAt = value; } 82 | } 83 | 84 | private LevelNumberType _LevelNfc = LevelNumberType.None ; 85 | 86 | public LevelNumberType LevelNfc 87 | { 88 | get { return _LevelNfc; } 89 | set { _LevelNfc = value; } 90 | } 91 | 92 | private int _LevelJc = 0; 93 | 94 | public int LevelJc 95 | { 96 | get { return _LevelJc; } 97 | set { _LevelJc = value; } 98 | } 99 | 100 | private int _LevelFollow = 0; 101 | 102 | public int LevelFollow 103 | { 104 | get { return _LevelFollow; } 105 | set { _LevelFollow = value; } 106 | } 107 | 108 | private string _FontName = null; 109 | /// 110 | /// 字体名称 111 | /// 112 | public string FontName 113 | { 114 | get { return _FontName; } 115 | set { _FontName = value; } 116 | } 117 | 118 | private string _LevelText = null; 119 | 120 | public string LevelText 121 | { 122 | get { return _LevelText; } 123 | set { _LevelText = value; } 124 | } 125 | 126 | public override string ToString() 127 | { 128 | if (this.LevelNfc == LevelNumberType.Bullet) 129 | { 130 | string text = "ID:" + this.ListID + " Bullet:"; 131 | if (string.IsNullOrEmpty(this.LevelText) == false) 132 | { 133 | text = text + "(" + Convert.ToString((short)this.LevelText[0]) + ")"; 134 | } 135 | return text; 136 | } 137 | else 138 | { 139 | return "ID:" + this.ListID + " " + this.LevelNfc.ToString() + " Start:" + this.LevelStartAt; 140 | } 141 | } 142 | } 143 | } 144 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFNode.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | 12 | using System; 13 | 14 | namespace RtfDomParser 15 | { 16 | /// 17 | /// RTF parser node, this source code evolution from other software. 18 | /// 19 | public class RTFNode 20 | { 21 | /// 22 | /// initialize instance 23 | /// 24 | public RTFNode() 25 | { 26 | } 27 | 28 | public RTFNode( RTFNodeType type , string Key ) 29 | { 30 | intType = type ; 31 | this.strKeyword = Key ; 32 | } 33 | 34 | public RTFNode( RTFToken token ) 35 | { 36 | this.strKeyword = token.Key ; 37 | this.bolHasParameter = token.HasParam ; 38 | this.intParameter = token.Param ; 39 | if( token.Type == RTFTokenType.Control ) 40 | intType = RTFNodeType.Control ; 41 | else if( token.Type == RTFTokenType.Control ) 42 | intType = RTFNodeType.Control ; 43 | else if( token.Type == RTFTokenType.Keyword ) 44 | intType = RTFNodeType.Keyword ; 45 | else if( token.Type == RTFTokenType.ExtKeyword ) 46 | intType = RTFNodeType.ExtKeyword ; 47 | else if( token.Type == RTFTokenType.Text ) 48 | intType = RTFNodeType.Text ; 49 | else 50 | intType = RTFNodeType.Text ; 51 | } 52 | 53 | protected RTFNodeGroup myParent = null; 54 | /// 55 | /// parent node 56 | /// 57 | public virtual RTFNodeGroup Parent 58 | { 59 | get{ return myParent ;} 60 | set{ myParent = value;} 61 | } 62 | 63 | protected RTFRawDocument myOwnerDocument = null ; 64 | /// 65 | /// raw document which owner this node 66 | /// 67 | public virtual RTFRawDocument OwnerDocument 68 | { 69 | get{ return myOwnerDocument ;} 70 | set 71 | { 72 | myOwnerDocument = value; 73 | if( this.Nodes != null ) 74 | { 75 | foreach( RTFNode node in this.Nodes ) 76 | { 77 | node.OwnerDocument = value ; 78 | } 79 | } 80 | } 81 | } 82 | 83 | /// 84 | /// key word 85 | /// 86 | protected string strKeyword = null; 87 | /// 88 | /// Keyword 89 | /// 90 | public virtual string Keyword 91 | { 92 | get 93 | { 94 | return strKeyword ; 95 | } 96 | set 97 | { 98 | strKeyword = value; 99 | } 100 | } 101 | 102 | /// 103 | /// Whether this node has parameter 104 | /// 105 | protected bool bolHasParameter = false; 106 | /// 107 | /// Whether this node has parameter 108 | /// 109 | public virtual bool HasParameter 110 | { 111 | get 112 | { 113 | return bolHasParameter ; 114 | } 115 | set 116 | { 117 | bolHasParameter = value; 118 | } 119 | } 120 | 121 | protected int intParameter = 0; 122 | /// 123 | /// paramter value 124 | /// 125 | public virtual int Parameter 126 | { 127 | get 128 | { 129 | return intParameter ; 130 | } 131 | } 132 | 133 | /// 134 | /// child nodes 135 | /// 136 | public virtual RTFNodeList Nodes 137 | { 138 | get{ return null; } 139 | } 140 | 141 | 142 | /// 143 | /// index 144 | /// 145 | public int Index 146 | { 147 | get 148 | { 149 | if( myParent == null ) 150 | return 0 ; 151 | else 152 | return myParent.Nodes.IndexOf( this ); 153 | } 154 | } 155 | 156 | protected RTFNodeType intType = RTFNodeType.None ; 157 | /// 158 | /// node type 159 | /// 160 | public RTFNodeType Type 161 | { 162 | get 163 | { 164 | return intType ; 165 | } 166 | } 167 | 168 | /// 169 | /// previous node in parent nodes list 170 | /// 171 | public RTFNode PreviousNode 172 | { 173 | get 174 | { 175 | if( myParent != null ) 176 | { 177 | int index = myParent.Nodes.IndexOf( this ); 178 | if( index > 0 ) 179 | { 180 | return myParent.Nodes[ index - 1 ]; 181 | } 182 | } 183 | return null; 184 | } 185 | } 186 | /// 187 | /// next node in parent nodes list 188 | /// 189 | public RTFNode NextNode 190 | { 191 | get 192 | { 193 | if( myParent != null ) 194 | { 195 | int index = myParent.Nodes.IndexOf( this ); 196 | if( index >= 0 && index < myParent.Nodes.Count - 1 ) 197 | return myParent.Nodes[ index + 1 ] ; 198 | } 199 | return null; 200 | } 201 | } 202 | 203 | /// 204 | /// write to rtf document 205 | /// 206 | /// RTF text writer 207 | public virtual void Write( RTFWriter writer ) 208 | { 209 | if( intType == RTFNodeType.Control 210 | || intType == RTFNodeType.Keyword 211 | || intType == RTFNodeType.ExtKeyword ) 212 | { 213 | if (this.bolHasParameter) 214 | { 215 | writer.WriteKeyword( 216 | this.strKeyword + this.intParameter, 217 | this.intType == RTFNodeType.ExtKeyword); 218 | } 219 | else 220 | { 221 | writer.WriteKeyword( 222 | this.strKeyword, 223 | this.intType == RTFNodeType.ExtKeyword); 224 | } 225 | } 226 | else if (intType == RTFNodeType.Text) 227 | { 228 | writer.WriteText(this.strKeyword); 229 | } 230 | } 231 | } 232 | 233 | 234 | } -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFNodeGroup.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | using System; 11 | 12 | namespace RtfDomParser 13 | { 14 | /// 15 | /// RTF node group , this source code evolution from other software. 16 | /// 17 | public class RTFNodeGroup : RTFNode 18 | { 19 | /// 20 | /// initialize instance 21 | /// 22 | public RTFNodeGroup() 23 | { 24 | this.intType = RTFNodeType.Group ; 25 | } 26 | /// 27 | /// child node list 28 | /// 29 | protected RTFNodeList myNodes = new RTFNodeList(); 30 | /// 31 | /// child node list 32 | /// 33 | public override RTFNodeList Nodes 34 | { 35 | get 36 | { 37 | return myNodes ; 38 | } 39 | } 40 | 41 | /// 42 | /// get all child node deeply 43 | /// 44 | /// contains group type node 45 | /// child nodes list 46 | public RTFNodeList GetAllNodes( bool IncludeGroupNode ) 47 | { 48 | RTFNodeList list = new RTFNodeList(); 49 | this.AddAllNodes( list , IncludeGroupNode ); 50 | return list ; 51 | } 52 | 53 | private void AddAllNodes( RTFNodeList list , bool IncludeGroupNode ) 54 | { 55 | foreach( RTFNode node in myNodes ) 56 | { 57 | if( node is RTFNodeGroup ) 58 | { 59 | if( IncludeGroupNode ) 60 | list.Add( node ); 61 | ( ( RTFNodeGroup ) node ).AddAllNodes( list , IncludeGroupNode ); 62 | } 63 | else 64 | list.Add( node ); 65 | } 66 | } 67 | 68 | /// 69 | /// first child node 70 | /// 71 | public RTFNode FirstNode 72 | { 73 | get 74 | { 75 | if( myNodes.Count > 0 ) 76 | return myNodes[ 0 ]; 77 | else 78 | return null; 79 | } 80 | } 81 | 82 | public override string Keyword 83 | { 84 | get 85 | { 86 | if( myNodes.Count > 0 ) 87 | return myNodes[ 0 ].Keyword ; 88 | else 89 | return null; 90 | } 91 | set 92 | { 93 | 94 | } 95 | } 96 | 97 | public override bool HasParameter 98 | { 99 | get 100 | { 101 | if( myNodes.Count > 0 ) 102 | return myNodes[ 0 ].HasParameter ; 103 | else 104 | return false; 105 | } 106 | set 107 | { 108 | } 109 | } 110 | 111 | public override int Parameter 112 | { 113 | get 114 | { 115 | if( myNodes.Count > 0 ) 116 | return myNodes[ 0 ].Parameter ; 117 | else 118 | return 0 ; 119 | } 120 | } 121 | 122 | 123 | public virtual string Text 124 | { 125 | get 126 | { 127 | System.Text.StringBuilder myStr = new System.Text.StringBuilder(); 128 | foreach( RTFNode node in myNodes ) 129 | { 130 | if( node is RTFNodeGroup ) 131 | { 132 | myStr.Append( ( ( RTFNodeGroup ) node ).Text ); 133 | } 134 | if( node.Type == RTFNodeType.Text ) 135 | myStr.Append( node.Keyword ); 136 | } 137 | return myStr.ToString(); 138 | } 139 | } 140 | 141 | internal void MergeText() 142 | { 143 | RTFNodeList list = new RTFNodeList(); 144 | System.Text.StringBuilder myStr = new System.Text.StringBuilder(); 145 | ByteBuffer buffer = new ByteBuffer(); 146 | //System.IO.MemoryStream ms = new System.IO.MemoryStream(); 147 | //System.Text.Encoding encode = myOwnerDocument.Encoding ; 148 | foreach( RTFNode node in myNodes ) 149 | { 150 | if( node.Type == RTFNodeType.Text ) 151 | { 152 | AddString( myStr , buffer ); 153 | myStr.Append( node.Keyword ); 154 | continue ; 155 | } 156 | if( node.Type == RTFNodeType.Control 157 | && node.Keyword == "\'" 158 | && node.HasParameter ) 159 | { 160 | buffer.Add( ( byte ) node.Parameter ); 161 | continue ; 162 | } 163 | else if( node.Type == RTFNodeType.Control || node.Type == RTFNodeType.Keyword ) 164 | { 165 | if( node.Keyword == "tab" ) 166 | { 167 | AddString( myStr , buffer ); 168 | myStr.Append( '\t' ); 169 | continue ; 170 | } 171 | if( node.Keyword == "emdash") 172 | { 173 | AddString( myStr , buffer ); 174 | // notice!! This code may cause compiler error in OS which not support chinese character. 175 | // you can change to myStr.Append('-'); 176 | myStr.Append( 'j'); 177 | continue ; 178 | } 179 | if( node.Keyword == "" ) 180 | { 181 | AddString( myStr , buffer ); 182 | // notice!! This code may cause compiler error in OS which not support chinese character. 183 | // you can change to myStr.Append('-'); 184 | myStr.Append( 'Ƀ' ); 185 | continue ; 186 | } 187 | } 188 | AddString( myStr , buffer ); 189 | if( myStr.Length > 0 ) 190 | { 191 | list.Add( new RTFNode( RTFNodeType.Text , myStr.ToString())); 192 | myStr = new System.Text.StringBuilder(); 193 | } 194 | list.Add( node ); 195 | }//foreach( RTFNode node in myNodes ) 196 | 197 | AddString( myStr , buffer ); 198 | if( myStr.Length > 0 ) 199 | { 200 | list.Add( new RTFNode( RTFNodeType.Text , myStr.ToString())); 201 | } 202 | myNodes.Clear(); 203 | foreach( RTFNode node in list ) 204 | { 205 | node.Parent = this ; 206 | node.OwnerDocument = myOwnerDocument ; 207 | myNodes.Add( node ); 208 | } 209 | } 210 | 211 | private void AddString( System.Text.StringBuilder myStr , ByteBuffer buffer ) 212 | { 213 | if( buffer.Count > 0 ) 214 | { 215 | //if( buffer.Count == 1 ) 216 | //{ 217 | // myStr.Append( ( char ) buffer[0] ); 218 | //} 219 | //else 220 | { 221 | string txt = buffer.GetString(myOwnerDocument.RuntimeEncoding); 222 | myStr.Append( txt ); 223 | } 224 | buffer.Reset(); 225 | } 226 | } 227 | /// 228 | /// write content to rtf document 229 | /// 230 | /// RTF text writer 231 | public override void Write(RTFWriter writer) 232 | { 233 | writer.WriteStartGroup(); 234 | foreach( RTFNode node in myNodes ) 235 | { 236 | node.Write( writer ); 237 | } 238 | writer.WriteEndGroup(); 239 | } 240 | 241 | /// 242 | /// search child node special keyword 243 | /// 244 | /// special keyword 245 | /// whether search deeplyl 246 | /// node find 247 | public RTFNode SearchKey( string Key , bool Deeply ) 248 | { 249 | foreach( RTFNode node in myNodes ) 250 | { 251 | if( node.Type == RTFNodeType.Keyword 252 | || node.Type == RTFNodeType.ExtKeyword 253 | || node.Type == RTFNodeType.Control ) 254 | { 255 | if( node.Keyword == Key ) 256 | return node ; 257 | } 258 | if( Deeply ) 259 | { 260 | if( node is RTFNodeGroup ) 261 | { 262 | RTFNodeGroup g = ( RTFNodeGroup ) node ; 263 | RTFNode n = g.SearchKey( Key , true ); 264 | if( n != null ) 265 | return n ; 266 | } 267 | } 268 | } 269 | return null; 270 | } 271 | 272 | /// 273 | /// append child node 274 | /// 275 | /// node 276 | public void AppendChild( RTFNode node ) 277 | { 278 | CheckNodes(); 279 | if( node == null ) 280 | throw new System.ArgumentNullException("node"); 281 | if( node == this ) 282 | throw new System.ArgumentException("node != this"); 283 | node.Parent = this ; 284 | node.OwnerDocument = myOwnerDocument ; 285 | this.Nodes.Add( node ); 286 | } 287 | /// 288 | /// delete node 289 | /// 290 | /// node 291 | public void RemoveChild( RTFNode node ) 292 | { 293 | CheckNodes(); 294 | if( node == null ) 295 | throw new System.ArgumentNullException("node"); 296 | if( node == this ) 297 | throw new System.ArgumentException("node != this"); 298 | this.Nodes.Remove( node ); 299 | } 300 | /// 301 | /// insert node 302 | /// 303 | /// index 304 | /// node 305 | public void InsertNode( int index , RTFNode node ) 306 | { 307 | CheckNodes(); 308 | if( node == null ) 309 | throw new System.ArgumentNullException("node"); 310 | if( node == this ) 311 | throw new System.ArgumentException("node != this"); 312 | node.Parent = this ; 313 | node.OwnerDocument = myOwnerDocument ; 314 | this.Nodes.Insert( index , node ); 315 | } 316 | 317 | private void CheckNodes() 318 | { 319 | if( this.Nodes == null ) 320 | throw new System.Exception("child node is invalidate"); 321 | } 322 | } 323 | } -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFNodeList.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | using System; 11 | 12 | namespace RtfDomParser 13 | { 14 | /// 15 | /// RTF node list , this source code evolution from other software. 16 | /// 17 | [System.Diagnostics.DebuggerDisplay("Count={ Count }")] 18 | [System.Diagnostics.DebuggerTypeProxy(typeof(RTFInstanceDebugView))] 19 | public class RTFNodeList : System.Collections.CollectionBase 20 | { 21 | /// 22 | /// get node special index 23 | /// 24 | public RTFNode this[ int index ] 25 | { 26 | get{ return ( RTFNode ) this.List[ index ] ;} 27 | } 28 | /// 29 | /// get node special keyword 30 | /// 31 | public RTFNode this[ string KeyWord ] 32 | { 33 | get 34 | { 35 | foreach( RTFNode node in this ) 36 | { 37 | if( node.Keyword == KeyWord ) 38 | return node ; 39 | } 40 | return null ; 41 | } 42 | } 43 | 44 | /// 45 | /// get node special type 46 | /// 47 | public RTFNode this[ Type t ] 48 | { 49 | get 50 | { 51 | foreach( RTFNode node in this ) 52 | { 53 | if( t.Equals( node.GetType())) 54 | return node ; 55 | } 56 | return null; 57 | } 58 | } 59 | 60 | /// 61 | /// get node's parameter value special keyword, if can not find , return default value. 62 | /// 63 | /// keyword 64 | /// default value 65 | /// parameter value 66 | public int GetParameter( string key , int DefaultValue ) 67 | { 68 | foreach( RTFNode node in this ) 69 | { 70 | if( node.Keyword == key && node.HasParameter ) 71 | return node.Parameter ; 72 | } 73 | return DefaultValue ; 74 | } 75 | 76 | public string Text 77 | { 78 | get 79 | { 80 | System.Text.StringBuilder myStr = new System.Text.StringBuilder(); 81 | foreach( RTFNode node in this ) 82 | { 83 | if( node.Type == RTFNodeType.Text ) 84 | { 85 | myStr.Append( node.Keyword ); 86 | } 87 | else if( node is RTFNodeGroup ) 88 | { 89 | string txt = node.Nodes.Text ; 90 | if( txt != null ) 91 | myStr.Append( txt ); 92 | } 93 | } 94 | return myStr.ToString(); 95 | } 96 | } 97 | 98 | /// 99 | /// detect whether exist node special keyword in this list 100 | /// 101 | /// keyword 102 | /// exist or not 103 | public bool ContainsKey( string Key ) 104 | { 105 | return this[ Key ] != null; 106 | } 107 | 108 | /// 109 | /// get index of node in this list 110 | /// 111 | /// node 112 | /// index , if node does no in this list , return -1 113 | public int IndexOf( RTFNode node ) 114 | { 115 | return this.List.IndexOf( node ); 116 | } 117 | 118 | internal void AddRange( RTFNodeList list ) 119 | { 120 | this.InnerList.AddRange( list ); 121 | } 122 | /// 123 | /// add node 124 | /// 125 | /// node 126 | internal void Add( RTFNode node ) 127 | { 128 | //node.OwnerList = this ; 129 | this.List.Add( node ); 130 | } 131 | /// 132 | /// remvoe node 133 | /// 134 | /// node 135 | internal void Remove( RTFNode node ) 136 | { 137 | this.Remove( node ); 138 | } 139 | /// 140 | /// insert node 141 | /// 142 | /// index 143 | /// node 144 | internal void Insert( int index , RTFNode node ) 145 | { 146 | this.List.Insert( index , node ); 147 | } 148 | } 149 | } -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFNodeType.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | using System; 12 | 13 | namespace RtfDomParser 14 | { 15 | /// 16 | /// RTF node type 17 | /// 18 | public enum RTFNodeType 19 | { 20 | /// 21 | /// root 22 | /// 23 | Root , 24 | /// 25 | /// keyword, etc /marginl 26 | /// 27 | Keyword , 28 | /// 29 | /// external keyword node , etc. /*/keyword 30 | /// 31 | ExtKeyword , 32 | /// 33 | /// control 34 | /// 35 | Control , 36 | /// 37 | /// plain text 38 | /// 39 | Text , 40 | /// 41 | /// group , etc . { } 42 | /// 43 | Group , 44 | /// 45 | /// nothing 46 | /// 47 | None 48 | } 49 | } -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFRawLayerInfo.cs: -------------------------------------------------------------------------------- 1 | using System; 2 | using System.Collections.Generic; 3 | using System.Text; 4 | 5 | namespace RtfDomParser 6 | { 7 | public class RTFRawLayerInfo 8 | { 9 | private int _UCValue = 0; 10 | 11 | public int UCValue 12 | { 13 | get { return _UCValue; } 14 | set 15 | { 16 | _UCValue = value; 17 | _UCValueCount = 0; 18 | } 19 | } 20 | 21 | private int _UCValueCount = 0; 22 | 23 | public int UCValueCount 24 | { 25 | get { return _UCValueCount; } 26 | set { _UCValueCount = value; } 27 | } 28 | /// 29 | /// 检查UC累计值 30 | /// 31 | /// 检查通过,能添加单字节字符 32 | public bool CheckUCValueCount() 33 | { 34 | _UCValueCount--; 35 | return _UCValueCount < 0; 36 | } 37 | public RTFRawLayerInfo Clone() 38 | { 39 | return (RTFRawLayerInfo)this.MemberwiseClone(); 40 | } 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFUtil.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SourceCodeBackup/RtfDomParser/b7277305198a1d88754ee364cfbfdea044ef1ff7/Source/RtfDomParser/RTFUtil.cs -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFVerticalAlignment.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | 11 | using System; 12 | 13 | namespace RtfDomParser 14 | { 15 | /// 16 | /// vertiacal alignment 17 | /// 18 | public enum RTFVerticalAlignment 19 | { 20 | /// 21 | /// top alignment 22 | /// 23 | Top, 24 | /// 25 | /// middle alignment 26 | /// 27 | Middle, 28 | /// 29 | /// bottom alignment 30 | /// 31 | Bottom 32 | } 33 | 34 | } 35 | -------------------------------------------------------------------------------- /Source/RtfDomParser/RTFWriter.cs: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SourceCodeBackup/RtfDomParser/b7277305198a1d88754ee364cfbfdea044ef1ff7/Source/RtfDomParser/RTFWriter.cs -------------------------------------------------------------------------------- /Source/RtfDomParser/RtfDomParser.csproj: -------------------------------------------------------------------------------- 1 |  2 | 3 | 4 | net7.0 5 | false 6 | false 7 | True 8 | RTF DOM Parser 9 | 7.0.0 10 | Nikolay.IT, yuan yong fu 11 | https://github.com/NikolayIT/RtfDomParser 12 | RtfDomParser (a.k.a. DCSoft.RTF and XDesigner.RTF) is an open source C# library for parsing RTF documents and generating RTF DOM Tree. 13 | Original version from yuan yong fu targeting .NET 7.0 with DCSoft.RTF namespaces 14 | RTF, RtfDomParser, DCSoft.RTF, XDesigner.RTF 15 | README.md 16 | https://github.com/SourceCodeBackup 17 | git 18 | LICENSE 19 | 20 | 21 | 22 | 23 | True 24 | \ 25 | 26 | 27 | True 28 | \ 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /Source/RtfDomParser/StringAttribute.cs: -------------------------------------------------------------------------------- 1 | /* 2 | * 3 | * DCSoft RTF DOM v1.0 4 | * Author : Yuan yong fu. 5 | * Email : yyf9989@hotmail.com 6 | * blog site:http://www.cnblogs.com/xdesigner. 7 | * 8 | */ 9 | 10 | using System; 11 | using System.Text; 12 | 13 | namespace RtfDomParser 14 | { 15 | /// 16 | /// string attribute 17 | /// 18 | [Serializable()] 19 | public class StringAttribute 20 | { 21 | /// 22 | /// initialize instance 23 | /// 24 | public StringAttribute() 25 | { 26 | } 27 | 28 | private string strName = null; 29 | /// 30 | /// name 31 | /// 32 | [System.ComponentModel.DefaultValue( null )] 33 | public string Name 34 | { 35 | get 36 | { 37 | return strName; 38 | } 39 | set 40 | { 41 | strName = value; 42 | } 43 | } 44 | 45 | private string strValue = null; 46 | /// 47 | /// value 48 | /// 49 | [System.ComponentModel.DefaultValue( null)] 50 | public string Value 51 | { 52 | get 53 | { 54 | return strValue; 55 | } 56 | set 57 | { 58 | strValue = value; 59 | } 60 | } 61 | public override string ToString() 62 | { 63 | return strName + "=" + strValue; 64 | } 65 | } 66 | 67 | [Serializable()] 68 | [System.Diagnostics.DebuggerTypeProxy(typeof(RTFInstanceDebugView))] 69 | public class StringAttributeCollection : System.Collections.CollectionBase 70 | { 71 | public StringAttributeCollection() 72 | { 73 | } 74 | 75 | public string this[string name] 76 | { 77 | get 78 | { 79 | foreach (StringAttribute attr in this) 80 | { 81 | if (attr.Name == name) 82 | { 83 | return attr.Value; 84 | } 85 | } 86 | return null; 87 | } 88 | set 89 | { 90 | foreach (StringAttribute item in this) 91 | { 92 | if (item.Name == name) 93 | { 94 | if (value == null) 95 | this.List.Remove(item); 96 | else 97 | item.Value = value; 98 | return; 99 | } 100 | } 101 | if (value != null) 102 | { 103 | StringAttribute newItem = new StringAttribute(); 104 | newItem.Name = name; 105 | newItem.Value = value; 106 | this.List.Add(newItem); 107 | } 108 | } 109 | } 110 | 111 | public int Add(StringAttribute item) 112 | { 113 | return this.List.Add(item); 114 | } 115 | 116 | public void Remove(StringAttribute item) 117 | { 118 | this.List.Remove(item); 119 | } 120 | } 121 | } 122 | -------------------------------------------------------------------------------- /Source/RtfDomParser/yyf.snk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SourceCodeBackup/RtfDomParser/b7277305198a1d88754ee364cfbfdea044ef1ff7/Source/RtfDomParser/yyf.snk -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: 1.0.{build} 2 | build: 3 | verbosity: minimal --------------------------------------------------------------------------------