Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions nrtftree-examples/simple-demo/Demo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ private static void PrintSpanishMenu()
public static void ExtractDocumentProperties()
{
RtfTree tree = new RtfTree();
tree.LoadRtfFile("..\\..\\testdocs\\test-doc.rtf");
tree.LoadRtfFile("testdocs\\test-doc.rtf");

InfoGroup info = tree.GetInfoGroup();

Expand All @@ -201,9 +201,9 @@ public static void ExtractDocumentProperties()
public static void GenerateRtfTree()
{
RtfTree tree = new RtfTree();
tree.LoadRtfFile("..\\..\\testdocs\\test-doc.rtf");
tree.LoadRtfFile("testdocs\\test-doc.rtf");

StreamWriter sw = new StreamWriter("..\\..\\testdocs\\rtftree.txt");
StreamWriter sw = new StreamWriter("testdocs\\rtftree.txt");

Console.WriteLine("Generating RTF tree...");

Expand All @@ -219,9 +219,9 @@ public static void GenerateRtfTree()
public static void ExtractPlainText()
{
RtfTree tree = new RtfTree();
tree.LoadRtfFile("..\\..\\testdocs\\test-doc.rtf");
tree.LoadRtfFile("testdocs\\test-doc.rtf");

StreamWriter sw = new StreamWriter("..\\..\\testdocs\\rtftext.txt");
StreamWriter sw = new StreamWriter("testdocs\\rtftext.txt");

Console.WriteLine("Extracting text...");

Expand All @@ -237,7 +237,7 @@ public static void ExtractPlainText()
public static void ExtractDocumentOutline()
{
RtfTree tree = new RtfTree();
tree.LoadRtfFile("..\\..\\testdocs\\test-doc.rtf");
tree.LoadRtfFile("testdocs\\test-doc.rtf");

RtfStyleSheetTable sst = tree.GetStyleSheetTable();

Expand Down Expand Up @@ -284,7 +284,7 @@ public static void ExtractDocumentOutline()
private static void ExtractHyperlinks()
{
RtfTree tree = new RtfTree();
tree.LoadRtfFile("..\\..\\testdocs\\test-doc.rtf");
tree.LoadRtfFile("testdocs\\test-doc.rtf");

RtfNodeCollection fields = tree.MainGroup.SelectGroups("field");

Expand Down Expand Up @@ -326,7 +326,7 @@ private static string ExtractGroupText(RtfTreeNode group)
private static void ExtractImages()
{
RtfTree tree = new RtfTree();
tree.LoadRtfFile("..\\..\\testdocs\\test-doc.rtf");
tree.LoadRtfFile("testdocs\\test-doc.rtf");

RtfNodeCollection imageNodes = tree.RootNode.SelectNodes("pict");

Expand All @@ -339,7 +339,7 @@ private static void ExtractImages()

if (imageNode.ImageFormat == ImageFormat.Png)
{
imageNode.SaveImage("..\\..\\testdocs\\image" + i + ".png");
imageNode.SaveImage("testdocs\\image" + i + ".png");

Console.WriteLine("File '" + "image" + i + ".png" + "' created.");

Expand All @@ -353,7 +353,7 @@ private static void ExtractImages()
private static void ExtractObjects()
{
RtfTree tree = new RtfTree();
tree.LoadRtfFile("..\\..\\testdocs\\test-doc.rtf");
tree.LoadRtfFile("testdocs\\test-doc.rtf");

//Busca el primer nodo de tipo objeto.
RtfNodeCollection objects = tree.RootNode.SelectGroups("object");
Expand All @@ -372,7 +372,7 @@ private static void ExtractObjects()

byte[] data = objectNode.GetByteData();

FileStream binaryFile = new FileStream("..\\..\\testdocs\\object" + i + ".xls", FileMode.Create, FileAccess.ReadWrite);
FileStream binaryFile = new FileStream("testdocs\\object" + i + ".xls", FileMode.Create, FileAccess.ReadWrite);
BinaryWriter bw = new BinaryWriter(binaryFile);

for (int j = 38; j < data.Length; j++)
Expand All @@ -398,13 +398,13 @@ private static void TagFormat()

RtfReader reader = new RtfReader(parser);

reader.LoadRtfFile("..\\..\\testdocs\\test-doc2.rtf");
reader.LoadRtfFile("testdocs\\test-doc2.rtf");

Console.WriteLine("Processing...");

reader.Parse();

StreamWriter sw = new StreamWriter("..\\..\\testdocs\\taggedfile.txt");
StreamWriter sw = new StreamWriter("testdocs\\taggedfile.txt");
sw.Write(parser.doc);
sw.Flush();
sw.Close();
Expand All @@ -416,15 +416,15 @@ private static void TagFormat()

private static void MergeDocuments()
{
RtfMerger merger = new RtfMerger("..\\..\\testdocs\\test-doc3.rtf");
RtfMerger merger = new RtfMerger("testdocs\\test-doc3.rtf");

merger.AddPlaceHolder("[TagTextRTF1]", "..\\..\\testdocs\\merge1.rtf");
merger.AddPlaceHolder("[TagTextRTF2]", "..\\..\\testdocs\\merge2.rtf");
merger.AddPlaceHolder("[TagTextRTF1]", "testdocs\\merge1.rtf");
merger.AddPlaceHolder("[TagTextRTF2]", "testdocs\\merge2.rtf");

Console.WriteLine("Processing...");

RtfTree tree = merger.Merge();
tree.SaveRtf("..\\..\\testdocs\\merge-result.rtf");
tree.SaveRtf("testdocs\\merge-result.rtf");

Console.WriteLine("File 'merge-result.txt' created.");

Expand All @@ -434,15 +434,15 @@ private static void MergeDocuments()
private static void ConvertToHtml()
{
RtfTree tree = new RtfTree();
tree.LoadRtfFile("..\\..\\testdocs\\test-doc2.rtf");
tree.LoadRtfFile("testdocs\\test-doc2.rtf");

Rtf2Html rtfToHtml = new Rtf2Html();

Console.WriteLine("Processing...");
rtfToHtml.IncrustImages = false;
string html = rtfToHtml.Convert(tree.Rtf);

StreamWriter sw = new StreamWriter("..\\..\\testdocs\\test.html", false);
StreamWriter sw = new StreamWriter("testdocs\\test.html", false);
sw.Write(html);
sw.Flush();
sw.Close();
Expand Down
4 changes: 2 additions & 2 deletions nrtftree-examples/simple-demo/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.4.0")]
[assembly: AssemblyFileVersion("0.4.0")]
[assembly: AssemblyVersion("0.5.0")]
[assembly: AssemblyFileVersion("0.5.0")]
61 changes: 5 additions & 56 deletions nrtftree-examples/simple-demo/simple-demo.csproj
Original file line number Diff line number Diff line change
@@ -1,66 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{F6B17017-FC6F-4992-8411-DB42CD80D881}</ProjectGuid>
<OutputType>Exe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<TargetFramework>net6.0</TargetFramework>
<RootNamespace>simple_demo</RootNamespace>
<AssemblyName>simple-demo</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<PlatformTarget>x86</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="Demo.cs" />
<Compile Include="HtmlEntities.cs" />
<Compile Include="MyParser.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Rtf2Html.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\nrtftree-library\nrtftree-library.csproj">
<Project>{7114E863-9D7D-4507-B38B-B859A0C1B836}</Project>
<Name>nrtftree-library</Name>
</ProjectReference>
<ProjectReference Include="..\..\nrtftree-library\nrtftree-library.csproj" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="testdocs/*" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
4 changes: 2 additions & 2 deletions nrtftree-library/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.4.0")]
[assembly: AssemblyFileVersion("0.4.0")]
[assembly: AssemblyVersion("0.5.0")]
[assembly: AssemblyFileVersion("0.5.0")]
2 changes: 1 addition & 1 deletion nrtftree-library/RtfTree.cs
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ public InfoGroup GetInfoGroup()
public Encoding GetEncoding()
{
//Contributed by Jan Stuchl�k

Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
Encoding encoding = Encoding.Default;

RtfTreeNode cpNode = RootNode.SelectSingleNode("ansicpg");
Expand Down
75 changes: 10 additions & 65 deletions nrtftree-library/nrtftree-library.csproj
Original file line number Diff line number Diff line change
@@ -1,76 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProductVersion>8.0.30703</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
<ProjectGuid>{7114E863-9D7D-4507-B38B-B859A0C1B836}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>nrtftree_library</RootNamespace>
<RootNamespace>Net.Sgoliver.NRtfTree</RootNamespace>
<AssemblyName>nrtftree-library</AssemblyName>
<TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\nrtftree-library.XML</DocumentationFile>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<TargetFramework>net6.0</TargetFramework>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
<OutputType>Library</OutputType>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
<LangVersion>10.0</LangVersion>
<NoWarn>CA1416</NoWarn>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Drawing" />
<Reference Include="System.Xml" />
</ItemGroup>
<ItemGroup>
<Compile Include="ImageNode.cs" />
<Compile Include="InfoGroup.cs" />
<Compile Include="ObjectNode.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="RtfCharFormat.cs" />
<Compile Include="RtfColorTable.cs" />
<Compile Include="RtfDocument.cs" />
<Compile Include="RtfDocumentFormat.cs" />
<Compile Include="RtfFontTable.cs" />
<Compile Include="RtfLex.cs" />
<Compile Include="RtfMerger.cs" />
<Compile Include="RtfNodeCollection.cs" />
<Compile Include="RtfNodeType.cs" />
<Compile Include="RtfParFormat.cs" />
<Compile Include="RtfPullParser.cs" />
<Compile Include="RtfReader.cs" />
<Compile Include="RtfStyleSheet.cs" />
<Compile Include="RtfStyleSheetTable.cs" />
<Compile Include="RtfStyleSheetType.cs" />
<Compile Include="RtfToken.cs" />
<Compile Include="RtfTokenType.cs" />
<Compile Include="RtfTree.cs" />
<Compile Include="RtfTreeNode.cs" />
<Compile Include="SarParser.cs" />
<Compile Include="TextAlignment.cs" />
<PackageReference Include="System.Drawing.Common" Version="6.0.0" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>
6 changes: 3 additions & 3 deletions nrtftree-test/HeaderSectionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,11 +40,11 @@ public class HeaderSectionsTest
{
RtfTree tree = null;

[TestFixtureSetUp]
[OneTimeSetUp]
public void InitTestFixture()
{
tree = new RtfTree();
tree.LoadRtfFile("..\\..\\testdocs\\testdoc2.rtf");
tree.LoadRtfFile("testdocs\\testdoc2.rtf");
}

[SetUp]
Expand Down Expand Up @@ -153,7 +153,7 @@ public void InfoGroupTest()
//sw.Flush();
//sw.Close();

StreamReader sr = new StreamReader("..\\..\\testdocs\\infogroup.txt");
StreamReader sr = new StreamReader("testdocs\\infogroup.txt");
string infoString = sr.ReadToEnd();
sr.Close();

Expand Down
Loading