 |
|
 |
Hi, is it possible to merge rtf documents to one document with this library without losing styles, tables etc. from the original documents. An example would be nice. Thank you in advance.
Olli
|
|
|
|
 |
|
 |
Hi,
i've just finished to do this job.
I've done new class to merge different RTF document.
Here is just a small example.
I've asked to project owner to include this my new class.
Regards
// create main Rtf doc and insert into main doc rtf placeholder
RtfDocument doc = new RtfDocument("..\\..\\SampleDoc\\RtfDoc.rtf");
RtfTextFormat textFmt = new RtfTextFormat();
textFmt.font = "Times New Roman";
textFmt.bold = true;
doc.AddText("[TagTextRTF1] Test File with placeholder [TagTextRTF1], place holder will be replaced with RTF file. Second Place holder into same line [TagTextRTF2].", textFmt);
textFmt.bold = false;
textFmt.underline = true;
textFmt.color = Color.Red;
doc.AddText("Second text (RED underlined text) with following place holder [TagTextRTF2]", textFmt);
doc.Close();
// create first to merge rtf doc
doc = new RtfDocument("..\\..\\SampleDoc\\ToMerge1.rtf");
textFmt = new RtfTextFormat();
textFmt.font = "Georgia";
textFmt.color = Color.Blue;
textFmt.bold = false;
doc.AddText("(Hi, i'm RTF content of your 1st placeholder)", textFmt);
doc.Close();
// create second to merge rtf doc
doc = new RtfDocument("..\\..\\SampleDoc\\ToMerge2.rtf");
textFmt = new RtfTextFormat();
textFmt.font = "Verdana";
textFmt.color = Color.Green;
textFmt.bold = false;
doc.AddText("(Hi, i'm RTF content of your 2nd placeholder)", textFmt);
doc.Close();
RtfMerger oTree = new RtfMerger();
oTree.MergeRtfDoc("..\\..\\SampleDoc\\RtfDoc.rtf", "\\[TagTextRTF(\\w+)\\]", new OtherRtfDocDelegate(manageDocToInsert), "..\\..\\SampleDoc\\Result.rtf", true, true);
MessageBox.Show("Test ended!");
}
BoFabio
|
|
|
|
 |
|
|
 |
|
|
 |
|
 |
Found issue with other character sets (eg. Chinese/Japanese etc).
Sample rtf string.
"{\rtf1\ansi\ansicpg1252\deff0\deflang2057{\fonttbl{\f0\froman\fprq1\fcharset128 Arial Unicode MS;}{\f1\fswiss\fcharset0 Arial;}}{\*\generator Msftedit 5.41.15.1507;}\viewkind4\uc1\pard\sb100\sa100\lang1033\f0\fs24\'82\'d0\'82\'e7\'82\'aa\'82\'c8\lang2057\f1\fs20\par}";
where '82\'d0\'82\'e7\'82\'aa\'82\'c8 is the text. But this is identified as Nodetype = control.
Thanks
Sathish
|
|
|
|
 |
|
 |
How would you parse the RTF document for merge codes and replace them with text?
|
|
|
|
 |
|
 |
Hi,
I would like find and replace text in rtf document, but I don't known how. Could you help me?
RtfTree tree = new RtfTree();
tree.LoadRtfFile(sourceFileName);
//
//Here, I need find and replace string (for example Find: |<CustomerName>| a Replace: Intel)
//
tree.SaveRtf(destinationFileName);
Lada
|
|
|
|
 |
|
 |
Have you solved your task? I've got the same problem!
|
|
|
|
 |
|
 |
I'll try to update the library in two/three weeks.
In the new version you can define templates, merge documents, find/replace text...
|
|
|
|
 |
|
 |
Thanks you so much for this feature, eagarly waiting for this
|
|
|
|
 |
|
 |
Different subject here. Could you provide an example in English on how to merger files?
Thanks
Gary
|
|
|
|
 |
|
 |
Hi, I have been looking at the help file and for the life of me I can't see how to convert rtf to html. Can someone give me a vb code example. Thanks
PQSIK
|
|
|
|
 |
|
 |
NRtfTree is NOT a library to convert RTF to HTML. NRtfTree can help you to proccess RTF documents in a general way, so you won't find any reference to HTML conversion in help files.
However, I have included an example of use of NRtfTree in the zip (Rtf to HTML conversion), but it's ONLY an example, and it's a very basic application. Have a look at the code of TraductorRtf.cs
-- modified at 15:17 Monday 26th November, 2007
|
|
|
|
 |
|
 |
HI.
Good work thanks for it.
I have one note:
In RtfLex class, function parse Text uses this contruction
StringBuilder Texto = new StringBuilder(((char)c).ToString(),3000000);
in my case it throws "Out of memory exception".
I changed it to
StringBuilder Texto = new StringBuilder(((char)c).ToString());
all works fine and speed of parsing increased in 6 times
sorry for bad English
|
|
|
|
 |
|
 |
Hi Orsol,
your modification is ok:
StringBuilder Texto = new StringBuilder(((char)c).ToString());
It will be corrected in final release.
Thanks.
|
|
|
|
 |
|
 |
That's not enough. Remove the separate StringBuilder from each token (plus the key and parameter handling ones), put one into the lexer itself, initialize it once when the lexer starts, and reuse the same StringBuilder every time you start a new token by simply setting its Length to zero. Processing speed will be more than a hundred times faster (not an exaggeration, I measured it). Also, you should rewrite the lexer because it is far from optimal (you Peek and Read the same characters repeatedly, this is not required, a lexer like this works all right with one character lookahead, consult a compiler textbook for details). Also, change the token class into a struct, that way you won't need to instantiate one for each token, this will give another boost of speed, about a factor of two or three.
|
|
|
|
 |
|
 |
Thanks for your comments.
|
|
|
|
 |
|
 |
Hi
The library is very good. i hv used it to convert a rtf file to html, but the table in rtf file not get parsed. so the tables in my rtf files appear as plain text in generated html
Ananta
-- modified at 7:26 Friday 25th May, 2007
|
|
|
|
 |
|
 |
Hi
I was wondering if you have any plan to port to C/C++. I saw your plan for Java. I am ignorant about C#, is it hard to translate to C++?
alam
|
|
|
|
 |
|
 |
I have just published in my web a new version of the library written in C++.
CRtfTree: http://www.sgoliver.net/crtftree.html
Note: I'm not the author of this version so I don't offer support for it.
|
|
|
|
 |
|
 |
Hi,
I can't find the license doc for crtftree. is it in public domain?
|
|
|
|
 |
|
 |
CRtfTree is a derived work of NRtfTree so it is GPL licensed.
|
|
|
|
 |
|
 |
Thank you for this nice library. But please clear a point to me: Is the C++ version GPL or LGPL? I understood that the original .net version is LGPL not GPL. Thanks
|
|
|
|
 |
|
|
 |
|
 |
Hello,
I am also interested in this lib - but the link does not work...
How can I get the library...?
Regards
Norbert Spiegel
|
|
|
|
 |