Author Topic: HTML to RTF  (Read 78285 times)

jj2007

  • Member
  • *****
  • Posts: 13300
  • Assembly is fun ;-)
    • MasmBasic
Re: HTML to RTF
« Reply #30 on: June 11, 2013, 04:38:40 PM »

To jj,i have free office who is launched by your application.
I give better results when i run it myself.

My app launches whatever your settings specify for RTF files, so if you have specified free office, you will see test_tmp.rtf in free office.

Re "better results": Post them, please. At least the executable.

TouEnMasm

  • Member
  • *****
  • Posts: 1762
    • EditMasm
Re: HTML to RTF
« Reply #31 on: June 11, 2013, 06:34:43 PM »
For the result,i just see the file in a very short lenght window.

I advance in the problem.
With no CDO the Imessage can load html page and work with
Code: [Select]
invoke CreateBstr,addr sz_null
mov bstr_null,eax
invoke Bstr_Url_File,TXT("C:\Documents and Settings\Luce\Bureau\The MASM Forum - Index.htm")
;invoke CreateBstr,TXT("http://luce.yves.pagesperso-orange.fr")
mov ecx,eax
IMessage CreateMHTMLBody,ecx,cdoSuppressNone,bstr_null,bstr_null
invoke CreateBstr,TXT("IBodyPart")
mov ecx,eax
;IMessage GetInterface ,ecx,addr ppvIBodyPart
I can get the text,the html and view it is loaded with the debugger
other interfaces are accessible in various way

Quote
         invoke CreateBstr,TXT("IBodyPart")
         mov ecx,eax
         IMessage GetInterface ,ecx,addr ppvIBodyPart
Fa is a musical note to play with CL

guga

  • Moderator
  • Member
  • *****
  • Posts: 1451
  • Assembly is a state of art.
    • RosAsm
Re: HTML to RTF
« Reply #32 on: June 11, 2013, 07:06:24 PM »
Hi JJ

this is an old word converter made in 97

It is old, but interesting, since it can convert some versions of rtf files.

The SDK is defined here:

http://support.microsoft.com/kb/q111716

I`m reading it and trying to port. As soon i finish i´ll post the equates i´m building for this

Aparently it can be done without opening any word processor.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

TouEnMasm

  • Member
  • *****
  • Posts: 1762
    • EditMasm
Re: HTML to RTF
« Reply #33 on: June 11, 2013, 07:09:22 PM »
Here the way folowed by microsoft to do the conversion
http://code.msdn.microsoft.com/windowsdesktop/Converting-between-RTF-and-aaa02a6e
Fa is a musical note to play with CL

jj2007

  • Member
  • *****
  • Posts: 13300
  • Assembly is fun ;-)
    • MasmBasic
Re: HTML to RTF
« Reply #34 on: June 11, 2013, 08:44:45 PM »
Hi JJ

this is an old word converter made in 97

It is old, but interesting, since it can convert some versions of rtf files.

The SDK is defined here:

http://support.microsoft.com/kb/q111716

I`m reading it and trying to port. As soon i finish i´ll post the equates i´m building for this

Aparently it can be done without opening any word processor.

Yes, apparently :biggrin:

What do you call "old"?

C:\Windows\System32\html.iec, 17.2.2012:
Company Name   Microsoft Corporation
File Description   Microsoft HTML Converter
FileVersion   2019.0.0.16978 (WIN7 IE9 RTM.110308-0330)
InternalName   HTML.IEC
Legal Copyright   © Microsoft Corporation. All rights reserved

TouEnMasm

  • Member
  • *****
  • Posts: 1762
    • EditMasm
Fa is a musical note to play with CL

jj2007

  • Member
  • *****
  • Posts: 13300
  • Assembly is fun ;-)
    • MasmBasic
Re: HTML to RTF
« Reply #36 on: June 12, 2013, 01:20:32 AM »
Quote
You have to adapt your application to generate XHTML documents if you want to use the XHTML2RTF conversion tool:

    Include an XML declaration at the beginning of the document:
    Collapse | Copy Code

    <?xml version="1.0" encoding="iso-8859-1" ?>

    Include XHTML namespace declaration (the default) and XHTML2RTF namespace declaration in tag <html>:
::)

TouEnMasm

  • Member
  • *****
  • Posts: 1762
    • EditMasm
Re: HTML to RTF
« Reply #37 on: June 12, 2013, 01:44:42 AM »

Must be that can be call a puzzle.I had one page who refuse to be translate and one page (coming from the forum).Just search between the two what is the differences.
 :idea:  :biggrin:

Fa is a musical note to play with CL

TouEnMasm

  • Member
  • *****
  • Posts: 1762
    • EditMasm
Re: HTML to RTF
« Reply #38 on: June 12, 2013, 02:07:42 AM »
Making it enough little this give
this one work:
Quote
<?xml version="1.0" encoding="iso-8859-1" ?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml2rtf="http://www.lutecia.info/download/xmlns/xhtml2rtf">
  <head>
    <title>Hello, World! from file</title>
  </head>
  <body>
    <h1>Hello, World!</h1>
  </body>
</html>

The one who don't work
Quote
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
<title>Sans titre</title>
<meta name="generator" content="Namo WebEditor v4.0">
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<p>&nbsp;</p>
</body>
</html>

Soluce:
Quote
<?xml version="1.0" encoding="iso-8859-1" ?>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:xhtml2rtf="http://www.lutecia.info/download/xmlns/xhtml2rtf">
<head>
<title>Sans titre</title>
</head>
<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
</body>
</html>
follow the links and you have two namespaces :idea: :idea: :idea:
Fa is a musical note to play with CL

guga

  • Moderator
  • Member
  • *****
  • Posts: 1451
  • Assembly is a state of art.
    • RosAsm
Re: HTML to RTF
« Reply #39 on: June 12, 2013, 08:10:37 AM »
Hi JJ....i called "old" because it is from 97. Tehre is no actualization on the documents so far, and the functions are undocumented on msdn (except for the sdk.doc i provided on the link).

I´m analysing the functionality of the functions to make the proper equates and structures for it. The functions seems interesting and it uses the convertes inside windows at:
HKEY_LOCAL_MACHINE\Software\Microsoft\Shared Tools\ (Import and Export subkeys)

I´m trying to make it work the function "GetReadNames", but so far, no success. It crashed all the time and now that i found how to fix, the result is always FALSE. I´m ot sure if the input i must provide the path of the registry (aparently not), or it will be only used as an output buffer for the files names/extentions/descriptions supported for import and export.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

guga

  • Moderator
  • Member
  • *****
  • Posts: 1451
  • Assembly is a state of art.
    • RosAsm
Re: HTML to RTF
« Reply #40 on: June 12, 2013, 09:46:39 AM »
OK, i guess i found it. this function GetReadNames needs an enumeration of the registry in order to get the proper buffers

There is a limit ? of 160 pointers to strings that can be used on the converter, but i didn´t check that yet
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

jj2007

  • Member
  • *****
  • Posts: 13300
  • Assembly is fun ;-)
    • MasmBasic
Re: HTML to RTF
« Reply #41 on: June 12, 2013, 03:39:46 PM »
Hi JJ....i called "old" because it is from 97. Tehre is no actualization on the documents so far, and the functions are undocumented on msdn

That applies to most of Windows ;-)

Quote
... uses the convertes inside windows at:
HKEY_LOCAL_MACHINE\Software\Microsoft\Shared Tools\ (Import and Export subkeys)

AFAIK it's the other way round: The HTML converter uses HTML.iec. The IEC probably stands for "Internet Explorer Converter", and MS produces a new version with every MSIE update, it seems.

TouEnMasm

  • Member
  • *****
  • Posts: 1762
    • EditMasm
Re: HTML to RTF
« Reply #42 on: June 12, 2013, 04:10:00 PM »
If i understand well there is texts translators provided by the system at:
Quote
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Text Converters
the converters had a .cnv extension who are dll.
usage of those dll are given by the GC1039 (winword converter) who give codes and all needed informations to use them.
More clear like that,not ?.


Fa is a musical note to play with CL

jj2007

  • Member
  • *****
  • Posts: 13300
  • Assembly is fun ;-)
    • MasmBasic
Re: HTML to RTF
« Reply #43 on: June 12, 2013, 04:25:26 PM »
If i understand well there is texts translators provided by the system at:
Quote
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Shared Tools\Text Converters
the converters had a .cnv extension who are dll.

Try renaming one of them (you will succeed). Then try to rename C:\Windows\System32\html.iec, and you may understand that the latter is more important for the OS - simply because html.iec is the low level engine for the HTML version of the Shared Tools converters, and probably has some other uses, too.

What my application (successfully) does is use the lowest level DLL directly, without making strange excursions to the wonderful world of COM.

TouEnMasm

  • Member
  • *****
  • Posts: 1762
    • EditMasm
Re: HTML to RTF
« Reply #44 on: June 12, 2013, 07:12:04 PM »

Quote
rename C:\Windows\System32\html.iec
No need to rename
Code: [Select]
invoke LoadLibrary,TXT("C:\windows\system32\html.iec")
works
Fa is a musical note to play with CL