zackrspv Posted June 11, 2009 Share Posted June 11, 2009 (edited) BY FAR NOT DONEHistory *Version .4 - Added automatic WMF -> JPG handling, fixing of HTML code to change WMF to JPG exteions; tested Word and Wordpad RTF, and they are compatible; Tested embeded images, JPG/BMP/WMF/EMF/GIF all embed, but Smart Art (2007) does not. Tables work, but table formatting (background/color) does not. Version .3 -- Initial Autoit Forum ReleaseWas trolling around this board, looking for code that could help with this, and didn't find too much. Wanted to be able to add it to my new chat app that i'm coding in Autoit. (The chat app's purpose is to provide HTML chat interface for Jabber conference rooms.)So, I looked around sf.net (sourceforge) and found a great project for RTF2HTML lite It REQUIRES the RTF and HTML to be files for the conversion, but it's pretty dang quick, and gets the job done.What it can do:BoldItalicsUnderlineStrikethroughBullets - see noteText ColorsCenter, Left, Right alignmentFont SizesFont changes (name, etc)What I havn't made it do yet:Add Images (tho the dll does support image conversion with an embded folder, which i do have in the include file)Background Colors (Have to code how to pull those from the RTF control, and then i can just replace them into the code before writing the final HTML code What I had to hack around to get done:Pull the first color in the RTF box, convert it from RGB to Hex, insert in into the HTML code, and recompile the HTML output (because the dll seems to like to miss .c11 color lol)Requirements:r2h.dllmscomct2.ocxr2h.au3Unimplemented RTF Features (To Do) (dll limitation, not autoit)Better support for OpenOffice Writer's RTF and Linux word processors, including buggy ones. "Table tag not closing" bug with OpenOffice's RTF. Prevent code from stupid RTF writers to generate redundant style references like f3 c4 f3 c4 f3 c4. Always add HTML <TITLE>; and META tags into header. Paragraph borders. Table cell size control. Table borders. Page Headers and Footers (not sure if needed at all). Support for hyperlinks (Microsoft-specific tags and/or automatic URL detection). HREF/SRC URL-encoding (usually not needed). Header (<H1>, <H2>...) tags (header formatting already works OK, but HTML header tags are not used).Examples really are not needed, because as long as you have the RTF, it should convert it (assuming you used the mscomct2.ocx to output the RTF (tho wordpad and word seem to work fine with it too).Example: Pulling the RTF from an embded mscomct2.ocx RTF control (using example in help file)FileWrite(@TempDir & "\r2h.rtf", $oRP.TextRTF) $code = r2h(@TempDir & "\r2h.rtf", @TempDir & "\r2h.html")Attached Filesr2h.au3 The functionRTFEditor.au3Very very basic (and isn't complete or foolproof editor)r2h.dllRTF2HTML dll file.NoteI have it set to autolaunch the HTML it generates, but you can remove it by removing the ShellExecute($HTML) line in the included file Edited June 11, 2009 by zackrspv mLipok 1 -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë. Link to comment Share on other sites More sharing options...
zackrspv Posted June 11, 2009 Author Share Posted June 11, 2009 Added more functionality for version .4; check main post for updates. Highlights: *Handles images a bit better, with embedded and non embedded folders *Handles WMF -> JPG conversion *Changes HTML source to fix WMF -> JPG conversion *Fixed function description and name; fixed R2H to _R2H, and fixed meaning of flag #1 (inserts image size from RTF code into the HTML Image code, dll still converts it using whatever manner it needs for WMF (default is converting from original to screen resolution) -_-------__--_-_-____---_-_--_-__-__-_ ^^€ñ†®øÞÿ ë×阮§ wï†høµ† ƒë@®, wï†høµ† †ïmë, @ñd wï†høµ† @ †ïmïdï†ÿ ƒø® !ïƒë. €×阮 ñø†, bµ† ïñ§†ë@d wï†hïñ, ñ@ÿ, †h®øµghøµ† †hë 맧ëñ§ë øƒ !ïƒë. Link to comment Share on other sites More sharing options...
Suppir Posted August 16, 2010 Share Posted August 16, 2010 Hello! Can you tell me. If I have RTF-data in clipboard, how should I use your function to create HTML-file ? Link to comment Share on other sites More sharing options...
eltorro Posted August 17, 2010 Share Posted August 17, 2010 You could get the RTF from the clipboard and write it to a temp file. Then, run the conversion on the temp file.See here on getting the RTF from the clipboard. Regards, [indent]ElTorro[/indent][font="Book"] Decide, Commit, Achieve[/font]_ConfigIO.au3Language Translation --uses Google(tm) MsgBox Move XML wrapper UDF XML2TreeView Zip functionality Split your GUI Save Print ScreenZipPluginEdit In Place listviewSome of my scripts on Google code Link to comment Share on other sites More sharing options...
saywell Posted September 20, 2010 Share Posted September 20, 2010 (edited) Hi, this looks like a useful tool for a project I'm working on, but I haven't been able to suss out how to use it! [edit] I've answered my original question, so deleted it. However, I do have a further small query about mscomct2.ocx. Does this have to be installed in \windows\system and registered in windows, or will it work OK sitting in @scriptdir? I've installed the dll to @scriptdir and added to windows\system and registered it on my PC and it works fine, but ideally I'd like not to have to do this on all the PCs [and possibly a server too] on which my app will be running on. Many thanks for a useful UDF, William Edited September 20, 2010 by saywell Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now