Access to create HTML file for WORD

P

Petr Danes

Does anyone have any experience with loading a document -INTO-Word using
HTML and a cascading style sheet? All the stuff I have found in the archives
deals with exporting Word docs to HTML - I want to do the opposite.

I have an ACCESS database that does lookups and uses VBA to create a Word
document detailing the results. Initially, I had the database using a Word
template to create the document, but the process was too slow to be useful,
so I converted it to write out plain text HTML, with references to a
cascading style sheet. The results are mixed. Speed is much improved, but
Word's use of the styles I define in the CSS are hit and miss. A sample few
lines of the generated HTML text and the entire style sheet are reproduced
at the end of this post.

The basic definition, the first style, named QuarxZakladOdstavec does not
appear at all in the created Word document, unless I add some unnecessary
text specifically using that style. The subsequent definitions, which I
would like to be based on this first one are not, but are based on Normal.
Some of the graphic definitions, specifically margins, seem to be ignored
completely. The styles are affected by whatever styles are already present
in Word, in fact, they seem to take precedence over those defined in the CSS
file, and I have to run some VBA code which deletes all 'Quarx' styles
before some changes take effect. (But not all, some CSS styles do take
effect next time the HTML file is loaded, even if the old style remains.)
The Access code opens a Word template, which uses this line to load the HTML
file:
doc.Range.InsertFile FileName:="abc.htm"
if that makes any difference.

Word is capable of creating this stuff from its native files as well as
reading files in this and other formats, but my results seem almost random.
If anyone can shed some light on this, or maybe even suggest a different
approach altogether, I'd appreciate some thoughts.

Pete



=====================================================
Beginning of generated HTML text file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
<head>
<title>Class and ID Selectors</title>
<meta http-equiv="Content-Type"
content="text/xhtml;charset=windows-1250"/>
<link rel='stylesheet' type='text/css' href='C:\Users\Petr
Danes\AppData\Local\Temp\QuarxStylesheet 2008-12-16_14-29-12.css'/>
</head>
<body >
<p class='QuarxZakladOdstavec'>
ABCEDFG
<p class='QuarxHS'>
.._HS Gottaischer [C:\Palma\T602\Hyper\A test\BATEL\BATELOV.TXT] {001}
</p>
<p class='QuarxPovel'>
..AU
</p>
<p class='QuarxAutor'>
Gottaischer
</p>
<p class='QuarxPovel'>
..TI
</p>
<p class='QuarxObycejnyText'>
Gottaischer Hofkalender fuer 1779, 1780.
</p>
<p class='QuarxPovel'>
..IM
</p>
<p class='QuarxObycejnyText'>
Goth a, s. t., 1779, 1780, 110, 175 s., 8´.
</p>
<p class='QuarxPovel'>
..RO
</p>
<p class='QuarxObycejnyText'>

</p>
<p class='QuarxPovel'>

<!--



Entire CSS file

/* Style Definitions */

/* Tohle je základ pro v¹echny dal¹í styly, pou¾ité pro rùzná oznaèení */

p.QuarxZakladOdstavec
{mso-style-name:QuarxZakladOdstavec;
mso-style-parent:"Normal";
mso-pagination:widow-orphan;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-family:"Courier New";}

/* Autor, signatura a datum jsou speciálnì oznaèené, aby byly rychle vidìt
*/

p.QuarxAutor
{mso-style-name:QuarxAutor;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:red;
font-weight:bold;}
p.QuarxSignatura
{mso-style-name:QuarxSignatura;
mso-style-parent:QuarxZakladOdstavec;
color:blue;
font-weight:bold;}
p.QuarxDatum
{mso-style-name:QuarxDatum;
mso-style-parent:QuarxZakladOdstavec;
color:#44BB44;
font-weight:bold;
text-decoration:underline;
text-underline:single;}
p.QuarxProvenience
{mso-style-name:QuarxProvenience;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-weight:bold;}

/* Záhlaví, oznaèené pomocí ._HS, je barvené podle toho, jestli heslo
obsahuje nebo neobsahuje hledaný text */

p.QuarxHS
{mso-style-name:QuarxHS;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
page-break-before:always;
mso-border-top-alt:solid black 0.5pt;
tab-stops:right 468.0pt;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#999999;}


/* Teèkové povely jsou oznaèené tady */

p.QuarxPovel
{mso-style-name:QuarxPovel;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#33CCCC;
display:none;
mso-hide:all;}


/* Teèkové povely jsou oznaèené tady */
p.QuarxObycejnyText
{mso-style-name:QuarxObycejnyText;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxPovel;
font-size:12.0pt;
margin-top:0pt;
margin-right:0pt;
margin-left:1.0cm;
margin-bottom:0pt;
font-family:"Courier New";}


/* Tady je speciální oznaèení nalezeného textu */

span.QuarxFound
{mso-style-name:QuarxFound;
background:pink;}

span.QuarxNalezenyText
{mso-style-name:QuarxNalezenyText;
background:yellow;
border:1px solid lime;}



--
This e-mail address is fake, to keep spammers and their address harvesters
out
of my hair. If you want to get in touch personally, I am 'pdanes' and I use
yahoo mail. But please use the newsgroup when possible, so that all may
benefit from the exchange of ideas.
 
P

Pete D.

I think you might do better in a word newsgroup. You seem to be quite
fluent in sending the html you want to word but making it format would be
more on the word side than the Access side. I have issues getting what I
want in HTML and style sheets even when doing it directly in word. Just my
thoughts. Pete

Petr Danes said:
Does anyone have any experience with loading a document -INTO-Word using
HTML and a cascading style sheet? All the stuff I have found in the
archives deals with exporting Word docs to HTML - I want to do the
opposite.

I have an ACCESS database that does lookups and uses VBA to create a Word
document detailing the results. Initially, I had the database using a Word
template to create the document, but the process was too slow to be
useful, so I converted it to write out plain text HTML, with references to
a cascading style sheet. The results are mixed. Speed is much improved,
but Word's use of the styles I define in the CSS are hit and miss. A
sample few lines of the generated HTML text and the entire style sheet are
reproduced at the end of this post.

The basic definition, the first style, named QuarxZakladOdstavec does not
appear at all in the created Word document, unless I add some unnecessary
text specifically using that style. The subsequent definitions, which I
would like to be based on this first one are not, but are based on Normal.
Some of the graphic definitions, specifically margins, seem to be ignored
completely. The styles are affected by whatever styles are already present
in Word, in fact, they seem to take precedence over those defined in the
CSS file, and I have to run some VBA code which deletes all 'Quarx' styles
before some changes take effect. (But not all, some CSS styles do take
effect next time the HTML file is loaded, even if the old style remains.)
The Access code opens a Word template, which uses this line to load the
HTML file:
doc.Range.InsertFile FileName:="abc.htm"
if that makes any difference.

Word is capable of creating this stuff from its native files as well as
reading files in this and other formats, but my results seem almost
random. If anyone can shed some light on this, or maybe even suggest a
different approach altogether, I'd appreciate some thoughts.

Pete



=====================================================
Beginning of generated HTML text file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
<head>
<title>Class and ID Selectors</title>
<meta http-equiv="Content-Type"
content="text/xhtml;charset=windows-1250"/>
<link rel='stylesheet' type='text/css' href='C:\Users\Petr
Danes\AppData\Local\Temp\QuarxStylesheet 2008-12-16_14-29-12.css'/>
</head>
<body >
<p class='QuarxZakladOdstavec'>
ABCEDFG
<p class='QuarxHS'>
._HS Gottaischer [C:\Palma\T602\Hyper\A test\BATEL\BATELOV.TXT]
{001}
</p>
<p class='QuarxPovel'>
.AU
</p>
<p class='QuarxAutor'>
Gottaischer
</p>
<p class='QuarxPovel'>
.TI
</p>
<p class='QuarxObycejnyText'>
Gottaischer Hofkalender fuer 1779, 1780.
</p>
<p class='QuarxPovel'>
.IM
</p>
<p class='QuarxObycejnyText'>
Goth a, s. t., 1779, 1780, 110, 175 s., 8´.
</p>
<p class='QuarxPovel'>
.RO
</p>
<p class='QuarxObycejnyText'>

</p>
<p class='QuarxPovel'>

<!--



Entire CSS file

/* Style Definitions */

/* Tohle je základ pro v¹echny dal¹í styly, pou¾ité pro rùzná oznaèení */

p.QuarxZakladOdstavec
{mso-style-name:QuarxZakladOdstavec;
mso-style-parent:"Normal";
mso-pagination:widow-orphan;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-family:"Courier New";}

/* Autor, signatura a datum jsou speciálnì oznaèené, aby byly rychle vidìt
*/

p.QuarxAutor
{mso-style-name:QuarxAutor;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:red;
font-weight:bold;}
p.QuarxSignatura
{mso-style-name:QuarxSignatura;
mso-style-parent:QuarxZakladOdstavec;
color:blue;
font-weight:bold;}
p.QuarxDatum
{mso-style-name:QuarxDatum;
mso-style-parent:QuarxZakladOdstavec;
color:#44BB44;
font-weight:bold;
text-decoration:underline;
text-underline:single;}
p.QuarxProvenience
{mso-style-name:QuarxProvenience;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-weight:bold;}

/* Záhlaví, oznaèené pomocí ._HS, je barvené podle toho, jestli heslo
obsahuje nebo neobsahuje hledaný text */

p.QuarxHS
{mso-style-name:QuarxHS;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
page-break-before:always;
mso-border-top-alt:solid black 0.5pt;
tab-stops:right 468.0pt;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#999999;}


/* Teèkové povely jsou oznaèené tady */

p.QuarxPovel
{mso-style-name:QuarxPovel;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#33CCCC;
display:none;
mso-hide:all;}


/* Teèkové povely jsou oznaèené tady */
p.QuarxObycejnyText
{mso-style-name:QuarxObycejnyText;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxPovel;
font-size:12.0pt;
margin-top:0pt;
margin-right:0pt;
margin-left:1.0cm;
margin-bottom:0pt;
font-family:"Courier New";}


/* Tady je speciální oznaèení nalezeného textu */

span.QuarxFound
{mso-style-name:QuarxFound;
background:pink;}

span.QuarxNalezenyText
{mso-style-name:QuarxNalezenyText;
background:yellow;
border:1px solid lime;}



--
This e-mail address is fake, to keep spammers and their address harvesters
out
of my hair. If you want to get in touch personally, I am 'pdanes' and I
use
yahoo mail. But please use the newsgroup when possible, so that all may
benefit from the exchange of ideas.
 
P

Petr Danes

Yes, I posted it to both a Word programming group as well as this Access
group, since a lot of Access freaks know quite a bit about the entire Office
package and its various interactions. Also, they often have good ideas about
how to restructure the entire setup to completely avoid a problem, rather
than concocting some laborious process to solve it.

Pete



Pete D. said:
I think you might do better in a word newsgroup. You seem to be quite
fluent in sending the html you want to word but making it format would be
more on the word side than the Access side. I have issues getting what I
want in HTML and style sheets even when doing it directly in word. Just my
thoughts. Pete

Petr Danes said:
Does anyone have any experience with loading a document -INTO-Word using
HTML and a cascading style sheet? All the stuff I have found in the
archives deals with exporting Word docs to HTML - I want to do the
opposite.

I have an ACCESS database that does lookups and uses VBA to create a Word
document detailing the results. Initially, I had the database using a
Word template to create the document, but the process was too slow to be
useful, so I converted it to write out plain text HTML, with references
to a cascading style sheet. The results are mixed. Speed is much
improved, but Word's use of the styles I define in the CSS are hit and
miss. A sample few lines of the generated HTML text and the entire style
sheet are reproduced at the end of this post.

The basic definition, the first style, named QuarxZakladOdstavec does not
appear at all in the created Word document, unless I add some unnecessary
text specifically using that style. The subsequent definitions, which I
would like to be based on this first one are not, but are based on
Normal. Some of the graphic definitions, specifically margins, seem to be
ignored completely. The styles are affected by whatever styles are
already present in Word, in fact, they seem to take precedence over those
defined in the CSS file, and I have to run some VBA code which deletes
all 'Quarx' styles before some changes take effect. (But not all, some
CSS styles do take effect next time the HTML file is loaded, even if the
old style remains.) The Access code opens a Word template, which uses
this line to load the HTML file:
doc.Range.InsertFile FileName:="abc.htm"
if that makes any difference.

Word is capable of creating this stuff from its native files as well as
reading files in this and other formats, but my results seem almost
random. If anyone can shed some light on this, or maybe even suggest a
different approach altogether, I'd appreciate some thoughts.

Pete



=====================================================
Beginning of generated HTML text file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
<head>
<title>Class and ID Selectors</title>
<meta http-equiv="Content-Type"
content="text/xhtml;charset=windows-1250"/>
<link rel='stylesheet' type='text/css' href='C:\Users\Petr
Danes\AppData\Local\Temp\QuarxStylesheet 2008-12-16_14-29-12.css'/>
</head>
<body >
<p class='QuarxZakladOdstavec'>
ABCEDFG
<p class='QuarxHS'>
._HS Gottaischer [C:\Palma\T602\Hyper\A test\BATEL\BATELOV.TXT]
{001}
</p>
<p class='QuarxPovel'>
.AU
</p>
<p class='QuarxAutor'>
Gottaischer
</p>
<p class='QuarxPovel'>
.TI
</p>
<p class='QuarxObycejnyText'>
Gottaischer Hofkalender fuer 1779, 1780.
</p>
<p class='QuarxPovel'>
.IM
</p>
<p class='QuarxObycejnyText'>
Goth a, s. t., 1779, 1780, 110, 175 s., 8´.
</p>
<p class='QuarxPovel'>
.RO
</p>
<p class='QuarxObycejnyText'>

</p>
<p class='QuarxPovel'>

<!--



Entire CSS file

/* Style Definitions */

/* Tohle je základ pro v¹echny dal¹í styly, pou¾ité pro rùzná oznaèení */

p.QuarxZakladOdstavec
{mso-style-name:QuarxZakladOdstavec;
mso-style-parent:"Normal";
mso-pagination:widow-orphan;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-family:"Courier New";}

/* Autor, signatura a datum jsou speciálnì oznaèené, aby byly rychle
vidìt */

p.QuarxAutor
{mso-style-name:QuarxAutor;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:red;
font-weight:bold;}
p.QuarxSignatura
{mso-style-name:QuarxSignatura;
mso-style-parent:QuarxZakladOdstavec;
color:blue;
font-weight:bold;}
p.QuarxDatum
{mso-style-name:QuarxDatum;
mso-style-parent:QuarxZakladOdstavec;
color:#44BB44;
font-weight:bold;
text-decoration:underline;
text-underline:single;}
p.QuarxProvenience
{mso-style-name:QuarxProvenience;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-weight:bold;}

/* Záhlaví, oznaèené pomocí ._HS, je barvené podle toho, jestli heslo
obsahuje nebo neobsahuje hledaný text */

p.QuarxHS
{mso-style-name:QuarxHS;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
page-break-before:always;
mso-border-top-alt:solid black 0.5pt;
tab-stops:right 468.0pt;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#999999;}


/* Teèkové povely jsou oznaèené tady */

p.QuarxPovel
{mso-style-name:QuarxPovel;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#33CCCC;
display:none;
mso-hide:all;}


/* Teèkové povely jsou oznaèené tady */
p.QuarxObycejnyText
{mso-style-name:QuarxObycejnyText;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxPovel;
font-size:12.0pt;
margin-top:0pt;
margin-right:0pt;
margin-left:1.0cm;
margin-bottom:0pt;
font-family:"Courier New";}


/* Tady je speciální oznaèení nalezeného textu */

span.QuarxFound
{mso-style-name:QuarxFound;
background:pink;}

span.QuarxNalezenyText
{mso-style-name:QuarxNalezenyText;
background:yellow;
border:1px solid lime;}



--
This e-mail address is fake, to keep spammers and their address
harvesters out
of my hair. If you want to get in touch personally, I am 'pdanes' and I
use
yahoo mail. But please use the newsgroup when possible, so that all may
benefit from the exchange of ideas.
 
S

Sylvain Lafontaine

Instead of using Range.InsertFile, maybe you should open the HTML document
as an independant word document and then transfert it to the real document.
For an example, see:

http://www.bokebb.com/dev/english/1990/posts/199082985.shtml

Also, this example is about using a RTF document instead of using HTML;
maybe you should do the same and use RTF instead of HTML. I won't be
surprisde if you have a better control over your RTF documents than over an
HTML document.

References on RTF:

http://en.wikipedia.org/wiki/Rich_Text_Format

http://www.microsoft.com/downloadS/...8D-FF06-4207-B476-6B5396A18A2B&displaylang=en

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=4&txtCodeId=6920

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


Petr Danes said:
Does anyone have any experience with loading a document -INTO-Word using
HTML and a cascading style sheet? All the stuff I have found in the
archives deals with exporting Word docs to HTML - I want to do the
opposite.

I have an ACCESS database that does lookups and uses VBA to create a Word
document detailing the results. Initially, I had the database using a Word
template to create the document, but the process was too slow to be
useful, so I converted it to write out plain text HTML, with references to
a cascading style sheet. The results are mixed. Speed is much improved,
but Word's use of the styles I define in the CSS are hit and miss. A
sample few lines of the generated HTML text and the entire style sheet are
reproduced at the end of this post.

The basic definition, the first style, named QuarxZakladOdstavec does not
appear at all in the created Word document, unless I add some unnecessary
text specifically using that style. The subsequent definitions, which I
would like to be based on this first one are not, but are based on Normal.
Some of the graphic definitions, specifically margins, seem to be ignored
completely. The styles are affected by whatever styles are already present
in Word, in fact, they seem to take precedence over those defined in the
CSS file, and I have to run some VBA code which deletes all 'Quarx' styles
before some changes take effect. (But not all, some CSS styles do take
effect next time the HTML file is loaded, even if the old style remains.)
The Access code opens a Word template, which uses this line to load the
HTML file:
doc.Range.InsertFile FileName:="abc.htm"
if that makes any difference.

Word is capable of creating this stuff from its native files as well as
reading files in this and other formats, but my results seem almost
random. If anyone can shed some light on this, or maybe even suggest a
different approach altogether, I'd appreciate some thoughts.

Pete



=====================================================
Beginning of generated HTML text file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
<head>
<title>Class and ID Selectors</title>
<meta http-equiv="Content-Type"
content="text/xhtml;charset=windows-1250"/>
<link rel='stylesheet' type='text/css' href='C:\Users\Petr
Danes\AppData\Local\Temp\QuarxStylesheet 2008-12-16_14-29-12.css'/>
</head>
<body >
<p class='QuarxZakladOdstavec'>
ABCEDFG
<p class='QuarxHS'>
._HS Gottaischer [C:\Palma\T602\Hyper\A test\BATEL\BATELOV.TXT]
{001}
</p>
<p class='QuarxPovel'>
.AU
</p>
<p class='QuarxAutor'>
Gottaischer
</p>
<p class='QuarxPovel'>
.TI
</p>
<p class='QuarxObycejnyText'>
Gottaischer Hofkalender fuer 1779, 1780.
</p>
<p class='QuarxPovel'>
.IM
</p>
<p class='QuarxObycejnyText'>
Goth a, s. t., 1779, 1780, 110, 175 s., 8´.
</p>
<p class='QuarxPovel'>
.RO
</p>
<p class='QuarxObycejnyText'>

</p>
<p class='QuarxPovel'>

<!--



Entire CSS file

/* Style Definitions */

/* Tohle je základ pro v¹echny dal¹í styly, pou¾ité pro rùzná oznaèení */

p.QuarxZakladOdstavec
{mso-style-name:QuarxZakladOdstavec;
mso-style-parent:"Normal";
mso-pagination:widow-orphan;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-family:"Courier New";}

/* Autor, signatura a datum jsou speciálnì oznaèené, aby byly rychle vidìt
*/

p.QuarxAutor
{mso-style-name:QuarxAutor;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:red;
font-weight:bold;}
p.QuarxSignatura
{mso-style-name:QuarxSignatura;
mso-style-parent:QuarxZakladOdstavec;
color:blue;
font-weight:bold;}
p.QuarxDatum
{mso-style-name:QuarxDatum;
mso-style-parent:QuarxZakladOdstavec;
color:#44BB44;
font-weight:bold;
text-decoration:underline;
text-underline:single;}
p.QuarxProvenience
{mso-style-name:QuarxProvenience;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-weight:bold;}

/* Záhlaví, oznaèené pomocí ._HS, je barvené podle toho, jestli heslo
obsahuje nebo neobsahuje hledaný text */

p.QuarxHS
{mso-style-name:QuarxHS;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
page-break-before:always;
mso-border-top-alt:solid black 0.5pt;
tab-stops:right 468.0pt;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#999999;}


/* Teèkové povely jsou oznaèené tady */

p.QuarxPovel
{mso-style-name:QuarxPovel;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#33CCCC;
display:none;
mso-hide:all;}


/* Teèkové povely jsou oznaèené tady */
p.QuarxObycejnyText
{mso-style-name:QuarxObycejnyText;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxPovel;
font-size:12.0pt;
margin-top:0pt;
margin-right:0pt;
margin-left:1.0cm;
margin-bottom:0pt;
font-family:"Courier New";}


/* Tady je speciální oznaèení nalezeného textu */

span.QuarxFound
{mso-style-name:QuarxFound;
background:pink;}

span.QuarxNalezenyText
{mso-style-name:QuarxNalezenyText;
background:yellow;
border:1px solid lime;}



--
This e-mail address is fake, to keep spammers and their address harvesters
out
of my hair. If you want to get in touch personally, I am 'pdanes' and I
use
yahoo mail. But please use the newsgroup when possible, so that all may
benefit from the exchange of ideas.
 
P

Petr Danes

Hm, hadn't thought of the RTF path. I'll have to study the specs and see if
it can do everything I need. It looks promising, I had no idea that RTF was
such a capable format. Including all the formatting inline may bulk the file
a bit, but I'll give it a try.

Still, the CSS/HTML route should work as well. Any ideas why it's giving me
so much trouble?

As for the Range.InsertFile, I forget now exactly why I did it that way,
rather than simply opening a file, but there was a reason. I think maybe it
was because the Open command opens a new document each time it is called,
causing them to pile up when doing multiple searches.



Sylvain Lafontaine said:
Instead of using Range.InsertFile, maybe you should open the HTML document
as an independant word document and then transfert it to the real
document. For an example, see:

http://www.bokebb.com/dev/english/1990/posts/199082985.shtml

Also, this example is about using a RTF document instead of using HTML;
maybe you should do the same and use RTF instead of HTML. I won't be
surprisde if you have a better control over your RTF documents than over
an HTML document.

References on RTF:

http://en.wikipedia.org/wiki/Rich_Text_Format

http://www.microsoft.com/downloadS/...8D-FF06-4207-B476-6B5396A18A2B&displaylang=en

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=4&txtCodeId=6920

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


Petr Danes said:
Does anyone have any experience with loading a document -INTO-Word using
HTML and a cascading style sheet? All the stuff I have found in the
archives deals with exporting Word docs to HTML - I want to do the
opposite.

I have an ACCESS database that does lookups and uses VBA to create a Word
document detailing the results. Initially, I had the database using a
Word template to create the document, but the process was too slow to be
useful, so I converted it to write out plain text HTML, with references
to a cascading style sheet. The results are mixed. Speed is much
improved, but Word's use of the styles I define in the CSS are hit and
miss. A sample few lines of the generated HTML text and the entire style
sheet are reproduced at the end of this post.

The basic definition, the first style, named QuarxZakladOdstavec does not
appear at all in the created Word document, unless I add some unnecessary
text specifically using that style. The subsequent definitions, which I
would like to be based on this first one are not, but are based on
Normal. Some of the graphic definitions, specifically margins, seem to be
ignored completely. The styles are affected by whatever styles are
already present in Word, in fact, they seem to take precedence over those
defined in the CSS file, and I have to run some VBA code which deletes
all 'Quarx' styles before some changes take effect. (But not all, some
CSS styles do take effect next time the HTML file is loaded, even if the
old style remains.) The Access code opens a Word template, which uses
this line to load the HTML file:
doc.Range.InsertFile FileName:="abc.htm"
if that makes any difference.

Word is capable of creating this stuff from its native files as well as
reading files in this and other formats, but my results seem almost
random. If anyone can shed some light on this, or maybe even suggest a
different approach altogether, I'd appreciate some thoughts.

Pete



=====================================================
Beginning of generated HTML text file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
<head>
<title>Class and ID Selectors</title>
<meta http-equiv="Content-Type"
content="text/xhtml;charset=windows-1250"/>
<link rel='stylesheet' type='text/css' href='C:\Users\Petr
Danes\AppData\Local\Temp\QuarxStylesheet 2008-12-16_14-29-12.css'/>
</head>
<body >
<p class='QuarxZakladOdstavec'>
ABCEDFG
<p class='QuarxHS'>
._HS Gottaischer [C:\Palma\T602\Hyper\A test\BATEL\BATELOV.TXT]
{001}
</p>
<p class='QuarxPovel'>
.AU
</p>
<p class='QuarxAutor'>
Gottaischer
</p>
<p class='QuarxPovel'>
.TI
</p>
<p class='QuarxObycejnyText'>
Gottaischer Hofkalender fuer 1779, 1780.
</p>
<p class='QuarxPovel'>
.IM
</p>
<p class='QuarxObycejnyText'>
Goth a, s. t., 1779, 1780, 110, 175 s., 8´.
</p>
<p class='QuarxPovel'>
.RO
</p>
<p class='QuarxObycejnyText'>

</p>
<p class='QuarxPovel'>

<!--



Entire CSS file

/* Style Definitions */

/* Tohle je základ pro v¹echny dal¹í styly, pou¾ité pro rùzná oznaèení */

p.QuarxZakladOdstavec
{mso-style-name:QuarxZakladOdstavec;
mso-style-parent:"Normal";
mso-pagination:widow-orphan;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-family:"Courier New";}

/* Autor, signatura a datum jsou speciálnì oznaèené, aby byly rychle
vidìt */

p.QuarxAutor
{mso-style-name:QuarxAutor;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:red;
font-weight:bold;}
p.QuarxSignatura
{mso-style-name:QuarxSignatura;
mso-style-parent:QuarxZakladOdstavec;
color:blue;
font-weight:bold;}
p.QuarxDatum
{mso-style-name:QuarxDatum;
mso-style-parent:QuarxZakladOdstavec;
color:#44BB44;
font-weight:bold;
text-decoration:underline;
text-underline:single;}
p.QuarxProvenience
{mso-style-name:QuarxProvenience;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-weight:bold;}

/* Záhlaví, oznaèené pomocí ._HS, je barvené podle toho, jestli heslo
obsahuje nebo neobsahuje hledaný text */

p.QuarxHS
{mso-style-name:QuarxHS;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
page-break-before:always;
mso-border-top-alt:solid black 0.5pt;
tab-stops:right 468.0pt;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#999999;}


/* Teèkové povely jsou oznaèené tady */

p.QuarxPovel
{mso-style-name:QuarxPovel;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#33CCCC;
display:none;
mso-hide:all;}


/* Teèkové povely jsou oznaèené tady */
p.QuarxObycejnyText
{mso-style-name:QuarxObycejnyText;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxPovel;
font-size:12.0pt;
margin-top:0pt;
margin-right:0pt;
margin-left:1.0cm;
margin-bottom:0pt;
font-family:"Courier New";}


/* Tady je speciální oznaèení nalezeného textu */

span.QuarxFound
{mso-style-name:QuarxFound;
background:pink;}

span.QuarxNalezenyText
{mso-style-name:QuarxNalezenyText;
background:yellow;
border:1px solid lime;}



--
This e-mail address is fake, to keep spammers and their address
harvesters out
of my hair. If you want to get in touch personally, I am 'pdanes' and I
use
yahoo mail. But please use the newsgroup when possible, so that all may
benefit from the exchange of ideas.
 
A

a a r o n . k e m p f

----------------------------------------------------------------------------------------
Access, however, is not perfect. Performance degrades significantly as
the database size increases. The database is also prone to corruption.
Finally, starting with an Access database has tempted many developers
to do a dangerous thing. Sometimes a single-user application becomes
popular enough that there's a desire for it to be used by multiple
simultaneous users. The temptation is to just move the Access database
file to a network share, copy the application to multiple machines,
and let many users connect simultaneously. Access performance drops
off quickly with multiple users, and it's highly unlikely that an
application that was designed for a single user will work reliably
with concurrent users.

http://msdn.microsoft.com/en-us/library/aa730870(VS.80).aspx
----------------------------------------------------------------------------------------




Hm, hadn't thought of the RTF path. I'll have to study the specs and see if
it can do everything I need. It looks promising, I had no idea that RTF was
such a capable format. Including all the formatting inline may bulk the file
a bit, but I'll give it a try.

Still, the CSS/HTML route should work as well. Any ideas why it's giving me
so much trouble?

As for the Range.InsertFile, I forget now exactly why I did it that way,
rather than simply opening a file, but there was a reason. I think maybe it
was because the Open command opens a new document each time it is called,
causing them to pile up when doing multiple searches.

"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)> pí¹e
v diskusním pøíspìvku

Instead of using Range.InsertFile, maybe you should open the HTML document
as an independant word document and then transfert it to the real
document. For an example, see:

Also, this example is about using a RTF document instead of using HTML;
maybe you should do the same and use RTF instead of HTML.  I won't be
surprisde if you have a better control over your RTF documents than over
an HTML document.
References on RTF:
Petr Danes said:
Does anyone have any experience with loading a document -INTO-Word using
HTML and a cascading style sheet? All the stuff I have found in the
archives deals with exporting Word docs to HTML - I want to do the
opposite.
I have an ACCESS database that does lookups and uses VBA to create a Word
document detailing the results. Initially, I had the database using a
Word template to create the document, but the process was too slow to be
useful, so I converted it to write out plain text HTML, with references
to a cascading style sheet. The results are mixed.Speedis much
improved, but Word's use of the styles I define in the CSS are hit and
miss. A sample few lines of the generated HTML text and the entire style
sheet are reproduced at the end of this post.
The basic definition, the first style, named QuarxZakladOdstavec does not
appear at all in the created Word document, unless I add some unnecessary
text specifically using that style. The subsequent definitions, which I
would like to be based on this first one are not, but are based on
Normal. Some of the graphic definitions, specifically margins, seem tobe
ignored completely. The styles are affected by whatever styles are
already present in Word, in fact, they seem to take precedence over those
defined in the CSS file, and I have to run some VBA code which deletes
all 'Quarx' styles before some changes take effect. (But not all, some
CSS styles do take effect next time the HTML file is loaded, even if the
old style remains.) The Access code opens a Word template, which uses
this line to load the HTML file:
doc.Range.InsertFile FileName:="abc.htm"
if that makes any difference.
Word is capable of creating this stuff from its native files as well as
reading files in this and other formats, but my results seem almost
random. If anyone can shed some light on this, or maybe even suggest a
different approach altogether, I'd appreciate some thoughts.
Pete
=====================================================
Beginning of generated HTML text file:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
   <head>
       <title>Class and ID Selectors</title>
       <meta http-equiv="Content-Type"
content="text/xhtml;charset=windows-1250"/>
       <link rel='stylesheet' type='text/css' href='C:\Users\Petr
Danes\AppData\Local\Temp\QuarxStylesheet 2008-12-16_14-29-12.css'/>
   </head>
   <body >
<p class='QuarxZakladOdstavec'>
ABCEDFG
<p class='QuarxHS'>
._HS Gottaischer [C:\Palma\T602\Hyper\A test\BATEL\BATELOV.TXT]
{001}
</p>
<p class='QuarxPovel'>
.AU
</p>
<p class='QuarxAutor'>
Gottaischer
</p>
<p class='QuarxPovel'>
.TI
</p>
<p class='QuarxObycejnyText'>
Gottaischer Hofkalender fuer 1779, 1780.
</p>
<p class='QuarxPovel'>
.IM
</p>
<p class='QuarxObycejnyText'>
Goth a, s. t., 1779, 1780, 110, 175 s., 8´.
</p>
<p class='QuarxPovel'>
.RO
</p>
<p class='QuarxObycejnyText'>
</p>
<p class='QuarxPovel'>
<!--
Entire CSS file
/* Style Definitions */
/* Tohle je základ pro v¹echny dal¹í styly, pou¾ité pro rùzná oznaèení */
p.QuarxZakladOdstavec
 {mso-style-name:QuarxZakladOdstavec;
 mso-style-parent:"Normal";
 mso-pagination:widow-orphan;
 font-size:12.0pt;
 margin-top:0pt;
 margin-bottom:0pt;
 font-family:"Courier New";}
/* Autor, signatura a datum jsou speciálnì oznaèené, aby byly rychle
vidìt */
p.QuarxAutor
 {mso-style-name:QuarxAutor;
 mso-style-parent:QuarxZakladOdstavec;
 font-size:12.0pt;
 margin-top:0pt;
 margin-bottom:0pt;
 color:red;
 font-weight:bold;}
p.QuarxSignatura
 {mso-style-name:QuarxSignatura;
 mso-style-parent:QuarxZakladOdstavec;
 color:blue;
 font-weight:bold;}
p.QuarxDatum
 {mso-style-name:QuarxDatum;
 mso-style-parent:QuarxZakladOdstavec;
 color:#44BB44;
 font-weight:bold;
 text-decoration:underline;
 text-underline:single;}
p.QuarxProvenience
 {mso-style-name:QuarxProvenience;
 mso-style-parent:QuarxZakladOdstavec;
 font-size:12.0pt;
 margin-top:0pt;
 margin-bottom:0pt;
 font-weight:bold;}
/* Záhlaví, oznaèené pomocí ._HS, je barvené podle toho, jestli heslo
obsahuje nebo neobsahuje hledaný text */
p.QuarxHS
 {mso-style-name:QuarxHS;
 mso-style-parent:QuarxZakladOdstavec;
 mso-style-next:QuarxZakladOdstavec;
 page-break-before:always;
 mso-border-top-alt:solid black 0.5pt;
 tab-stops:right 468.0pt;
 font-size:8.0pt;
 margin-top:0pt;
 margin-bottom:0pt;
 color:#999999;}
/* Teèkové povely jsou oznaèené tady */
p.QuarxPovel
 {mso-style-name:QuarxPovel;
 mso-style-parent:QuarxZakladOdstavec;
 mso-style-next:QuarxZakladOdstavec;
 font-size:8.0pt;
 margin-top:0pt;
 margin-bottom:0pt;
 color:#33CCCC;
 display:none;
 mso-hide:all;}
/* Teèkové povely jsou oznaèené tady */
p.QuarxObycejnyText
 {mso-style-name:QuarxObycejnyText;
 mso-style-parent:QuarxZakladOdstavec;
 mso-style-next:QuarxPovel;
 font-size:12.0pt;
 margin-top:0pt;
 margin-right:0pt;
 margin-left:1.0cm;
 margin-bottom:0pt;
 font-family:"Courier New";}
/* Tady je speciální oznaèení nalezeného textu */
span.QuarxFound
{mso-style-name:QuarxFound;
background:pink;}
span.QuarxNalezenyText
{mso-style-name:QuarxNalezenyText;
background:yellow;
border:1px solid lime;}
--
This e-mail address is fake, to keep spammers and their address
harvesters out
of my hair. If you want to get in touch personally, I am 'pdanes' and I
use
yahoo mail. But please use the newsgroup when possible, so that all may
benefit from the exchange of ideas.- Hide quoted text -

- Show quoted text -
 
T

Tony Toews [MVP]

Access, however, is not perfect.

And that paragraph is exceedingly slanted and by someone who clearly
doesn't understand Access.

How many hours did it take you to find that paragraph?

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
A

a a r o n . k e m p f

Well you're the idiot that's stuck reccomending an obsolete database.

We're not the ones that are slanted-- YOU ARE.

JET IS OBSOLETE AND IT HAS BEEN FOR A DECADE.

-Aaron
 
P

Pete D.

Hi,
I went off the wagon today and said something about Aaron, and I said I
wouldn't months ago. Maybe it is time for this newsgroup to come up with a
standard response, agree on it and copy and paste as needed. No matter what
is said we respond with the same response. Something clear and simple for
the new person and something the expert can say...I've seen this before. If
no matter what he says he gets the same response, he will have no place to
go. He will eventualy go to another newsgroup.

My imput
Aaron always recommends MS SQL to all questions in this NewsGroup. Although
MS SQL Server is a great program it may not apply to many
situations...Please all, feel free to help make Aaron go away
\
 
T

Tony Toews [MVP]

Pete D. said:
He will eventualy go to another newsgroup.

We've been hoping for several years.
Aaron always recommends MS SQL to all questions in this NewsGroup. Although
MS SQL Server is a great program it may not apply to many
situations...Please all, feel free to help make Aaron go away

Hmm, gotta think about this a bit.

Tony
--
Tony Toews, Microsoft Access MVP
Please respond only in the newsgroups so that others can
read the entire thread of messages.
Microsoft Access Links, Hints, Tips & Accounting Systems at
http://www.granite.ab.ca/accsmstr.htm
Tony's Microsoft Access Blog - http://msmvps.com/blogs/access/
 
S

Sylvain Lafontaine

Sorry, but I've no idea why CSS/HTML is giving you so much trouble.
Personally, I don't use it for Word and I would probably use Automation if I
ever had to create a Word document. However, as this solution seems to be
to slow in your case, suggesting to take a look at the RTF format seems to
be a promising path.

I've also noticed that you are using a template to create your new document
and that this document is probably using the standard Normal.DOT file for
its basic formatting. Maybe one of these is the source of your problem.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


Petr Danes said:
Hm, hadn't thought of the RTF path. I'll have to study the specs and see
if it can do everything I need. It looks promising, I had no idea that RTF
was such a capable format. Including all the formatting inline may bulk
the file a bit, but I'll give it a try.

Still, the CSS/HTML route should work as well. Any ideas why it's giving
me so much trouble?

As for the Range.InsertFile, I forget now exactly why I did it that way,
rather than simply opening a file, but there was a reason. I think maybe
it was because the Open command opens a new document each time it is
called, causing them to pile up when doing multiple searches.



Sylvain Lafontaine said:
Instead of using Range.InsertFile, maybe you should open the HTML
document as an independant word document and then transfert it to the
real document. For an example, see:

http://www.bokebb.com/dev/english/1990/posts/199082985.shtml

Also, this example is about using a RTF document instead of using HTML;
maybe you should do the same and use RTF instead of HTML. I won't be
surprisde if you have a better control over your RTF documents than over
an HTML document.

References on RTF:

http://en.wikipedia.org/wiki/Rich_Text_Format

http://www.microsoft.com/downloadS/...8D-FF06-4207-B476-6B5396A18A2B&displaylang=en

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=4&txtCodeId=6920

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


Petr Danes said:
Does anyone have any experience with loading a document -INTO-Word using
HTML and a cascading style sheet? All the stuff I have found in the
archives deals with exporting Word docs to HTML - I want to do the
opposite.

I have an ACCESS database that does lookups and uses VBA to create a
Word document detailing the results. Initially, I had the database using
a Word template to create the document, but the process was too slow to
be useful, so I converted it to write out plain text HTML, with
references to a cascading style sheet. The results are mixed. Speed is
much improved, but Word's use of the styles I define in the CSS are hit
and miss. A sample few lines of the generated HTML text and the entire
style sheet are reproduced at the end of this post.

The basic definition, the first style, named QuarxZakladOdstavec does
not appear at all in the created Word document, unless I add some
unnecessary text specifically using that style. The subsequent
definitions, which I would like to be based on this first one are not,
but are based on Normal. Some of the graphic definitions, specifically
margins, seem to be ignored completely. The styles are affected by
whatever styles are already present in Word, in fact, they seem to take
precedence over those defined in the CSS file, and I have to run some
VBA code which deletes all 'Quarx' styles before some changes take
effect. (But not all, some CSS styles do take effect next time the HTML
file is loaded, even if the old style remains.) The Access code opens a
Word template, which uses this line to load the HTML file:
doc.Range.InsertFile FileName:="abc.htm"
if that makes any difference.

Word is capable of creating this stuff from its native files as well as
reading files in this and other formats, but my results seem almost
random. If anyone can shed some light on this, or maybe even suggest a
different approach altogether, I'd appreciate some thoughts.

Pete



=====================================================
Beginning of generated HTML text file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
<head>
<title>Class and ID Selectors</title>
<meta http-equiv="Content-Type"
content="text/xhtml;charset=windows-1250"/>
<link rel='stylesheet' type='text/css' href='C:\Users\Petr
Danes\AppData\Local\Temp\QuarxStylesheet 2008-12-16_14-29-12.css'/>
</head>
<body >
<p class='QuarxZakladOdstavec'>
ABCEDFG
<p class='QuarxHS'>
._HS Gottaischer [C:\Palma\T602\Hyper\A test\BATEL\BATELOV.TXT]
{001}
</p>
<p class='QuarxPovel'>
.AU
</p>
<p class='QuarxAutor'>
Gottaischer
</p>
<p class='QuarxPovel'>
.TI
</p>
<p class='QuarxObycejnyText'>
Gottaischer Hofkalender fuer 1779, 1780.
</p>
<p class='QuarxPovel'>
.IM
</p>
<p class='QuarxObycejnyText'>
Goth a, s. t., 1779, 1780, 110, 175 s., 8´.
</p>
<p class='QuarxPovel'>
.RO
</p>
<p class='QuarxObycejnyText'>

</p>
<p class='QuarxPovel'>

<!--



Entire CSS file

/* Style Definitions */

/* Tohle je základ pro v¹echny dal¹í styly, pou¾ité pro rùzná oznaèení
*/

p.QuarxZakladOdstavec
{mso-style-name:QuarxZakladOdstavec;
mso-style-parent:"Normal";
mso-pagination:widow-orphan;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-family:"Courier New";}

/* Autor, signatura a datum jsou speciálnì oznaèené, aby byly rychle
vidìt */

p.QuarxAutor
{mso-style-name:QuarxAutor;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:red;
font-weight:bold;}
p.QuarxSignatura
{mso-style-name:QuarxSignatura;
mso-style-parent:QuarxZakladOdstavec;
color:blue;
font-weight:bold;}
p.QuarxDatum
{mso-style-name:QuarxDatum;
mso-style-parent:QuarxZakladOdstavec;
color:#44BB44;
font-weight:bold;
text-decoration:underline;
text-underline:single;}
p.QuarxProvenience
{mso-style-name:QuarxProvenience;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-weight:bold;}

/* Záhlaví, oznaèené pomocí ._HS, je barvené podle toho, jestli heslo
obsahuje nebo neobsahuje hledaný text */

p.QuarxHS
{mso-style-name:QuarxHS;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
page-break-before:always;
mso-border-top-alt:solid black 0.5pt;
tab-stops:right 468.0pt;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#999999;}


/* Teèkové povely jsou oznaèené tady */

p.QuarxPovel
{mso-style-name:QuarxPovel;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#33CCCC;
display:none;
mso-hide:all;}


/* Teèkové povely jsou oznaèené tady */
p.QuarxObycejnyText
{mso-style-name:QuarxObycejnyText;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxPovel;
font-size:12.0pt;
margin-top:0pt;
margin-right:0pt;
margin-left:1.0cm;
margin-bottom:0pt;
font-family:"Courier New";}


/* Tady je speciální oznaèení nalezeného textu */

span.QuarxFound
{mso-style-name:QuarxFound;
background:pink;}

span.QuarxNalezenyText
{mso-style-name:QuarxNalezenyText;
background:yellow;
border:1px solid lime;}



--
This e-mail address is fake, to keep spammers and their address
harvesters out
of my hair. If you want to get in touch personally, I am 'pdanes' and I
use
yahoo mail. But please use the newsgroup when possible, so that all may
benefit from the exchange of ideas.
 
P

Petr Danes

I'm looking at the RTF specs. Whew, they're complicated. Maybe if I generate
my text once, then ask word to save it as an RTF file and examine the
result, it will shed some light on the subject. I'll try that next.

Yes, automation is the natural choice and is the first thing I tried. It
worked, quite well in fact, but was simply too slow to be practical.

I'm not sure I understand you regarding the template issue. I do have a
custom template, in fact, it's stored in the database as a blob and written
into the temp directory if it's not already there. Same with the CSS file.
The intention was to make the database completely self-contained, that is,
one-file portable. I know how to break the AttachedTemplate link from the
document, but this sounds like there may be more. Is there some tie between
a custom template and Normal.DOT? If so, what do I do about it?

Pete




Sylvain Lafontaine said:
Sorry, but I've no idea why CSS/HTML is giving you so much trouble.
Personally, I don't use it for Word and I would probably use Automation if
I ever had to create a Word document. However, as this solution seems to
be to slow in your case, suggesting to take a look at the RTF format seems
to be a promising path.

I've also noticed that you are using a template to create your new
document and that this document is probably using the standard Normal.DOT
file for its basic formatting. Maybe one of these is the source of your
problem.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


Petr Danes said:
Hm, hadn't thought of the RTF path. I'll have to study the specs and see
if it can do everything I need. It looks promising, I had no idea that
RTF was such a capable format. Including all the formatting inline may
bulk the file a bit, but I'll give it a try.

Still, the CSS/HTML route should work as well. Any ideas why it's giving
me so much trouble?

As for the Range.InsertFile, I forget now exactly why I did it that way,
rather than simply opening a file, but there was a reason. I think maybe
it was because the Open command opens a new document each time it is
called, causing them to pile up when doing multiple searches.



Sylvain Lafontaine said:
Instead of using Range.InsertFile, maybe you should open the HTML
document as an independant word document and then transfert it to the
real document. For an example, see:

http://www.bokebb.com/dev/english/1990/posts/199082985.shtml

Also, this example is about using a RTF document instead of using HTML;
maybe you should do the same and use RTF instead of HTML. I won't be
surprisde if you have a better control over your RTF documents than over
an HTML document.

References on RTF:

http://en.wikipedia.org/wiki/Rich_Text_Format

http://www.microsoft.com/downloadS/...8D-FF06-4207-B476-6B5396A18A2B&displaylang=en

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=4&txtCodeId=6920

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


Does anyone have any experience with loading a document -INTO-Word
using HTML and a cascading style sheet? All the stuff I have found in
the archives deals with exporting Word docs to HTML - I want to do the
opposite.

I have an ACCESS database that does lookups and uses VBA to create a
Word document detailing the results. Initially, I had the database
using a Word template to create the document, but the process was too
slow to be useful, so I converted it to write out plain text HTML, with
references to a cascading style sheet. The results are mixed. Speed is
much improved, but Word's use of the styles I define in the CSS are hit
and miss. A sample few lines of the generated HTML text and the entire
style sheet are reproduced at the end of this post.

The basic definition, the first style, named QuarxZakladOdstavec does
not appear at all in the created Word document, unless I add some
unnecessary text specifically using that style. The subsequent
definitions, which I would like to be based on this first one are not,
but are based on Normal. Some of the graphic definitions, specifically
margins, seem to be ignored completely. The styles are affected by
whatever styles are already present in Word, in fact, they seem to take
precedence over those defined in the CSS file, and I have to run some
VBA code which deletes all 'Quarx' styles before some changes take
effect. (But not all, some CSS styles do take effect next time the HTML
file is loaded, even if the old style remains.) The Access code opens a
Word template, which uses this line to load the HTML file:
doc.Range.InsertFile FileName:="abc.htm"
if that makes any difference.

Word is capable of creating this stuff from its native files as well as
reading files in this and other formats, but my results seem almost
random. If anyone can shed some light on this, or maybe even suggest a
different approach altogether, I'd appreciate some thoughts.

Pete



=====================================================
Beginning of generated HTML text file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
<head>
<title>Class and ID Selectors</title>
<meta http-equiv="Content-Type"
content="text/xhtml;charset=windows-1250"/>
<link rel='stylesheet' type='text/css' href='C:\Users\Petr
Danes\AppData\Local\Temp\QuarxStylesheet 2008-12-16_14-29-12.css'/>
</head>
<body >
<p class='QuarxZakladOdstavec'>
ABCEDFG
<p class='QuarxHS'>
._HS Gottaischer [C:\Palma\T602\Hyper\A test\BATEL\BATELOV.TXT]
{001}
</p>
<p class='QuarxPovel'>
.AU
</p>
<p class='QuarxAutor'>
Gottaischer
</p>
<p class='QuarxPovel'>
.TI
</p>
<p class='QuarxObycejnyText'>
Gottaischer Hofkalender fuer 1779, 1780.
</p>
<p class='QuarxPovel'>
.IM
</p>
<p class='QuarxObycejnyText'>
Goth a, s. t., 1779, 1780, 110, 175 s., 8´.
</p>
<p class='QuarxPovel'>
.RO
</p>
<p class='QuarxObycejnyText'>

</p>
<p class='QuarxPovel'>

<!--



Entire CSS file

/* Style Definitions */

/* Tohle je základ pro v¹echny dal¹í styly, pou¾ité pro rùzná oznaèení
*/

p.QuarxZakladOdstavec
{mso-style-name:QuarxZakladOdstavec;
mso-style-parent:"Normal";
mso-pagination:widow-orphan;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-family:"Courier New";}

/* Autor, signatura a datum jsou speciálnì oznaèené, aby byly rychle
vidìt */

p.QuarxAutor
{mso-style-name:QuarxAutor;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:red;
font-weight:bold;}
p.QuarxSignatura
{mso-style-name:QuarxSignatura;
mso-style-parent:QuarxZakladOdstavec;
color:blue;
font-weight:bold;}
p.QuarxDatum
{mso-style-name:QuarxDatum;
mso-style-parent:QuarxZakladOdstavec;
color:#44BB44;
font-weight:bold;
text-decoration:underline;
text-underline:single;}
p.QuarxProvenience
{mso-style-name:QuarxProvenience;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-weight:bold;}

/* Záhlaví, oznaèené pomocí ._HS, je barvené podle toho, jestli heslo
obsahuje nebo neobsahuje hledaný text */

p.QuarxHS
{mso-style-name:QuarxHS;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
page-break-before:always;
mso-border-top-alt:solid black 0.5pt;
tab-stops:right 468.0pt;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#999999;}


/* Teèkové povely jsou oznaèené tady */

p.QuarxPovel
{mso-style-name:QuarxPovel;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#33CCCC;
display:none;
mso-hide:all;}


/* Teèkové povely jsou oznaèené tady */
p.QuarxObycejnyText
{mso-style-name:QuarxObycejnyText;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxPovel;
font-size:12.0pt;
margin-top:0pt;
margin-right:0pt;
margin-left:1.0cm;
margin-bottom:0pt;
font-family:"Courier New";}


/* Tady je speciální oznaèení nalezeného textu */

span.QuarxFound
{mso-style-name:QuarxFound;
background:pink;}

span.QuarxNalezenyText
{mso-style-name:QuarxNalezenyText;
background:yellow;
border:1px solid lime;}



--
This e-mail address is fake, to keep spammers and their address
harvesters out
of my hair. If you want to get in touch personally, I am 'pdanes' and I
use
yahoo mail. But please use the newsgroup when possible, so that all may
benefit from the exchange of ideas.
 
A

a a r o n . k e m p f

Pete;

you can sit around and talk shit all you want.

But SQL Server won the war, and Jet is dead. Jet is obsolete and it
has been for a decade.
Anyone that tells you otherwise is too lazy to learn the worlds most
popular database.

I just can't wait until microsoft 'pulls a foxpro' on you guys, it's
already happened.. you guys just cling to a database format that has
been dead for a decade.

Time to get with the 90s, kids

-Aaron
 
A

a a r o n . k e m p f

Have you considered using SQL Server Reporting Services to export to
Word?

It works about 100 times better than MS Access, especially if you use
SQL 2008.
Microsoft bought 'SoftArtisans' and integrated their products into SQL
2008 SSRS, which is just a fantastic improvement, IMHO





I'm looking at the RTF specs. Whew, they're complicated. Maybe if I generate
my text once, then ask word to save it as an RTF file and examine the
result, it will shed some light on the subject. I'll try that next.

Yes, automation is the natural choice and is the first thing I tried. It
worked, quite well in fact, but was simply too slow to be practical.

I'm not sure I understand you regarding the template issue. I do have a
custom template, in fact, it's stored in the database as a blob and written
into the temp directory if it's not already there. Same with the CSS file..
The intention was to make the database completely self-contained, that is,
one-file portable. I know how to break the AttachedTemplate link from the
document, but this sounds like there may be more. Is there some tie between
a custom template and Normal.DOT? If so, what do I do about it?

Pete

"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)> pí¹e
v diskusním pøíspìvku

Sorry, but I've no idea why CSS/HTML is giving you so much trouble.
Personally, I don't use it for Word and I would probably use Automationif
I ever had to create a Word document.  However, as this solution seems to
be to slow in your case, suggesting to take a look at the RTF format seems
to be a promising path.
I've also noticed that you are using a template to create your new
document and that this document is probably using the standard Normal.DOT
file for its basic formatting.  Maybe one of these is the source of your
problem.
Petr Danes said:
Hm, hadn't thought of the RTF path. I'll have to study the specs and see
if it can do everything I need. It looks promising, I had no idea that
RTF was such a capable format. Including all the formatting inline may
bulk the file a bit, but I'll give it a try.
Still, the CSS/HTML route should work as well. Any ideas why it's giving
me so much trouble?
As for the Range.InsertFile, I forget now exactly why I did it that way,
rather than simply opening a file, but there was a reason. I think maybe
it was because the Open command opens a new document each time it is
called, causing them to pile up when doing multiple searches.
"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
pí¹e v diskusním pøíspìvkuInstead of using Range.InsertFile, maybe you should open the HTML
document as an independant word document and then transfert it to the
real document. For an example, see:
http://www.bokebb.com/dev/english/1990/posts/199082985.shtml
Also, this example is about using a RTF document instead of using HTML;
maybe you should do the same and use RTF instead of HTML.  I won't be
surprisde if you have a better control over your RTF documents than over
an HTML document.
References on RTF:
http://en.wikipedia.org/wiki/Rich_Text_Format
http://www.microsoft.com/downloadS/details.aspx?familyid=DD422B8D-FF0...
http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=4&tx...
--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)
Does anyone have any experience with loading a document -INTO-Word
using HTML and a cascading style sheet? All the stuff I have found in
the archives deals with exporting Word docs to HTML - I want to do the
opposite.
I have an ACCESS database that does lookups and uses VBA to create a
Word document detailing the results. Initially, I had the database
using a Word template to create the document, but the process was too
slow to be useful, so I converted it to write out plain text HTML, with
references to a cascading style sheet. The results are mixed. Speed is
much improved, but Word's use of the styles I define in the CSS are hit
and miss. A sample few lines of the generated HTML text and the entire
style sheet are reproduced at the end of this post.
The basic definition, the first style, named QuarxZakladOdstavec does
not appear at all in the created Word document, unless I add some
unnecessary text specifically using that style. The subsequent
definitions, which I would like to be based on this first one are not,
but are based on Normal. Some of the graphic definitions, specifically
margins, seem to be ignored completely. The styles are affected by
whatever styles are already present in Word, in fact, they seem to take
precedence over those defined in the CSS file, and I have to run some
VBA code which deletes all 'Quarx' styles before some changes take
effect. (But not all, some CSS styles do take effect next time the HTML
file is loaded, even if the old style remains.) The Access code opens a
Word template, which uses this line to load the HTML file:
doc.Range.InsertFile FileName:="abc.htm"
if that makes any difference.
Word is capable of creating this stuff from its native files as wellas
reading files in this and other formats, but my results seem almost
random. If anyone can shed some light on this, or maybe even suggesta
different approach altogether, I'd appreciate some thoughts.
Pete
=====================================================
Beginning of generated HTML text file:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
   <head>
       <title>Class and ID Selectors</title>
       <meta http-equiv="Content-Type"
content="text/xhtml;charset=windows-1250"/>
       <link rel='stylesheet' type='text/css' href='C:\Users\Petr
Danes\AppData\Local\Temp\QuarxStylesheet 2008-12-16_14-29-12.css'/>
   </head>
   <body >
<p class='QuarxZakladOdstavec'>
ABCEDFG
<p class='QuarxHS'>
._HS Gottaischer [C:\Palma\T602\Hyper\A test\BATEL\BATELOV.TXT]
{001}
</p>
<p class='QuarxPovel'>
.AU
</p>
<p class='QuarxAutor'>
Gottaischer
</p>
<p class='QuarxPovel'>
.TI
</p>
<p class='QuarxObycejnyText'>
Gottaischer Hofkalender fuer 1779, 1780.
</p>
<p class='QuarxPovel'>
.IM
</p>
<p class='QuarxObycejnyText'>
Goth a, s. t., 1779, 1780, 110, 175 s., 8´.
</p>
<p class='QuarxPovel'>
.RO
</p>
<p class='QuarxObycejnyText'>
</p>
<p class='QuarxPovel'>
<!--
Entire CSS file
/* Style Definitions */
/* Tohle je základ pro v¹echny dal¹í styly, pou¾ité pro rùzná oznaèení
*/
p.QuarxZakladOdstavec
 {mso-style-name:QuarxZakladOdstavec;
 mso-style-parent:"Normal";
 mso-pagination:widow-orphan;
 font-size:12.0pt;
 margin-top:0pt;
 margin-bottom:0pt;
 font-family:"Courier New";}
/* Autor, signatura a datum jsou speciálnì oznaèené, aby byly rychle
vidìt */
p.QuarxAutor
 {mso-style-name:QuarxAutor;
 mso-style-parent:QuarxZakladOdstavec;
 font-size:12.0pt;
 margin-top:0pt;
 margin-bottom:0pt;
 color:red;
 font-weight:bold;}
p.QuarxSignatura
 {mso-style-name:QuarxSignatura;
 mso-style-parent:QuarxZakladOdstavec;
 color:blue;
 font-weight:bold;}
p.QuarxDatum
 {mso-style-name:QuarxDatum;
 mso-style-parent:QuarxZakladOdstavec;
 color:#44BB44;
 font-weight:bold;
 text-decoration:underline;
 text-underline:single;}
p.QuarxProvenience
 {mso-style-name:QuarxProvenience;
 mso-style-parent:QuarxZakladOdstavec;
 font-size:12.0pt;
 margin-top:0pt;
 margin-bottom:0pt;
 font-weight:bold;}
/* Záhlaví, oznaèené pomocí ._HS, je barvené podle toho,jestli heslo
obsahuje nebo neobsahuje hledaný text */
p.QuarxHS
 {mso-style-name:QuarxHS;
 mso-style-parent:QuarxZakladOdstavec;
 mso-style-next:QuarxZakladOdstavec;
 page-break-before:always;
 mso-border-top-alt:solid black 0.5pt;
 tab-stops:right 468.0pt;
 font-size:8.0pt;
 margin-top:0pt;
 margin-bottom:0pt;
 color:#999999;}
/* Teèkové povely jsou oznaèené tady */
p.QuarxPovel
 {mso-style-name:QuarxPovel;
 mso-style-parent:QuarxZakladOdstavec;
 mso-style-next:QuarxZakladOdstavec;
 font-size:8.0pt;
 margin-top:0pt;
 margin-bottom:0pt;
 color:#33CCCC;
 display:none;
 mso-hide:all;}
/* Teèkové povely jsou oznaèené tady */
p.QuarxObycejnyText
 {mso-style-name:QuarxObycejnyText;
 mso-style-parent:QuarxZakladOdstavec;
 mso-style-next:QuarxPovel;
 font-size:12.0pt;
 margin-top:0pt;
 margin-right:0pt;
 margin-left:1.0cm;
 margin-bottom:0pt;
 font-family:"Courier New";}
/* Tady je speciální oznaèení nalezeného textu */
span.QuarxFound
{mso-style-name:QuarxFound;
background:pink;}
span.QuarxNalezenyText
{mso-style-name:QuarxNalezenyText;
background:yellow;
border:1px solid lime;}

...

read more »- Hide quoted text -

- Show quoted text -
 
W

Walt Kowalski

a a r o n . k e m p f @ g m a i l . c o said:
Have you considered using SQL Server Reporting
Services to export to Word?

I never expected to find a dumb squarehead hanging around, pushing SQL after
being laughed out of the SQL groups.

That's Mr. Kowalski to you
 
A

a a r o n . k e m p f

getting laughed out of the SQL groups?

what exactly are you referring to?

I don't need to save people in the SQL groups-- everyone knows that
SQL Server is the worlds most popular database
 
P

Peter Jamieson

If you only need to target Word 2003 or later it might be better to emit
WordProcessingML text rather than RTF, particularly if the formatting
requirements are fairly simple. Although I wouldn't as it's particularly
easy to grasp how the style stuff works in WordProcessingML, you're more
likely to be able to re-use existing XML knowledge and XML-related tools.


Peter Jamieson

http://tips.pjmsn.me.uk

Petr said:
I'm looking at the RTF specs. Whew, they're complicated. Maybe if I
generate my text once, then ask word to save it as an RTF file and
examine the result, it will shed some light on the subject. I'll try
that next.

Yes, automation is the natural choice and is the first thing I tried. It
worked, quite well in fact, but was simply too slow to be practical.

I'm not sure I understand you regarding the template issue. I do have a
custom template, in fact, it's stored in the database as a blob and
written into the temp directory if it's not already there. Same with the
CSS file. The intention was to make the database completely
self-contained, that is, one-file portable. I know how to break the
AttachedTemplate link from the document, but this sounds like there may
be more. Is there some tie between a custom template and Normal.DOT? If
so, what do I do about it?

Pete




Sylvain Lafontaine said:
Sorry, but I've no idea why CSS/HTML is giving you so much trouble.
Personally, I don't use it for Word and I would probably use
Automation if I ever had to create a Word document. However, as this
solution seems to be to slow in your case, suggesting to take a look
at the RTF format seems to be a promising path.

I've also noticed that you are using a template to create your new
document and that this document is probably using the standard
Normal.DOT file for its basic formatting. Maybe one of these is the
source of your problem.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


Petr Danes said:
Hm, hadn't thought of the RTF path. I'll have to study the specs and
see if it can do everything I need. It looks promising, I had no idea
that RTF was such a capable format. Including all the formatting
inline may bulk the file a bit, but I'll give it a try.

Still, the CSS/HTML route should work as well. Any ideas why it's
giving me so much trouble?

As for the Range.InsertFile, I forget now exactly why I did it that
way, rather than simply opening a file, but there was a reason. I
think maybe it was because the Open command opens a new document each
time it is called, causing them to pile up when doing multiple searches.



"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam
please)> pí¹e v diskusním pøíspìvku
Instead of using Range.InsertFile, maybe you should open the HTML
document as an independant word document and then transfert it to
the real document. For an example, see:

http://www.bokebb.com/dev/english/1990/posts/199082985.shtml

Also, this example is about using a RTF document instead of using
HTML; maybe you should do the same and use RTF instead of HTML. I
won't be surprisde if you have a better control over your RTF
documents than over an HTML document.

References on RTF:

http://en.wikipedia.org/wiki/Rich_Text_Format

http://www.microsoft.com/downloadS/...8D-FF06-4207-B476-6B5396A18A2B&displaylang=en


http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=4&txtCodeId=6920


--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


Does anyone have any experience with loading a document -INTO-Word
using HTML and a cascading style sheet? All the stuff I have found
in the archives deals with exporting Word docs to HTML - I want to
do the opposite.

I have an ACCESS database that does lookups and uses VBA to create
a Word document detailing the results. Initially, I had the
database using a Word template to create the document, but the
process was too slow to be useful, so I converted it to write out
plain text HTML, with references to a cascading style sheet. The
results are mixed. Speed is much improved, but Word's use of the
styles I define in the CSS are hit and miss. A sample few lines of
the generated HTML text and the entire style sheet are reproduced
at the end of this post.

The basic definition, the first style, named QuarxZakladOdstavec
does not appear at all in the created Word document, unless I add
some unnecessary text specifically using that style. The subsequent
definitions, which I would like to be based on this first one are
not, but are based on Normal. Some of the graphic definitions,
specifically margins, seem to be ignored completely. The styles are
affected by whatever styles are already present in Word, in fact,
they seem to take precedence over those defined in the CSS file,
and I have to run some VBA code which deletes all 'Quarx' styles
before some changes take effect. (But not all, some CSS styles do
take effect next time the HTML file is loaded, even if the old
style remains.) The Access code opens a Word template, which uses
this line to load the HTML file:
doc.Range.InsertFile FileName:="abc.htm"
if that makes any difference.

Word is capable of creating this stuff from its native files as
well as reading files in this and other formats, but my results
seem almost random. If anyone can shed some light on this, or maybe
even suggest a different approach altogether, I'd appreciate some
thoughts.

Pete



=====================================================
Beginning of generated HTML text file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
<head>
<title>Class and ID Selectors</title>
<meta http-equiv="Content-Type"
content="text/xhtml;charset=windows-1250"/>
<link rel='stylesheet' type='text/css' href='C:\Users\Petr
Danes\AppData\Local\Temp\QuarxStylesheet 2008-12-16_14-29-12.css'/>
</head>
<body >
<p class='QuarxZakladOdstavec'>
ABCEDFG
<p class='QuarxHS'>
._HS Gottaischer [C:\Palma\T602\Hyper\A
test\BATEL\BATELOV.TXT] {001}
</p>
<p class='QuarxPovel'>
.AU
</p>
<p class='QuarxAutor'>
Gottaischer
</p>
<p class='QuarxPovel'>
.TI
</p>
<p class='QuarxObycejnyText'>
Gottaischer Hofkalender fuer 1779, 1780.
</p>
<p class='QuarxPovel'>
.IM
</p>
<p class='QuarxObycejnyText'>
Goth a, s. t., 1779, 1780, 110, 175 s., 8´.
</p>
<p class='QuarxPovel'>
.RO
</p>
<p class='QuarxObycejnyText'>

</p>
<p class='QuarxPovel'>

<!--



Entire CSS file

/* Style Definitions */

/* Tohle je základ pro v¹echny dal¹í styly, pou¾ité pro rùzná
oznaèení */

p.QuarxZakladOdstavec
{mso-style-name:QuarxZakladOdstavec;
mso-style-parent:"Normal";
mso-pagination:widow-orphan;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-family:"Courier New";}

/* Autor, signatura a datum jsou speciálnì oznaèené, aby byly
rychle vidìt */

p.QuarxAutor
{mso-style-name:QuarxAutor;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:red;
font-weight:bold;}
p.QuarxSignatura
{mso-style-name:QuarxSignatura;
mso-style-parent:QuarxZakladOdstavec;
color:blue;
font-weight:bold;}
p.QuarxDatum
{mso-style-name:QuarxDatum;
mso-style-parent:QuarxZakladOdstavec;
color:#44BB44;
font-weight:bold;
text-decoration:underline;
text-underline:single;}
p.QuarxProvenience
{mso-style-name:QuarxProvenience;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-weight:bold;}

/* Záhlaví, oznaèené pomocí ._HS, je barvené podle toho, jestli
heslo obsahuje nebo neobsahuje hledaný text */

p.QuarxHS
{mso-style-name:QuarxHS;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
page-break-before:always;
mso-border-top-alt:solid black 0.5pt;
tab-stops:right 468.0pt;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#999999;}


/* Teèkové povely jsou oznaèené tady */

p.QuarxPovel
{mso-style-name:QuarxPovel;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#33CCCC;
display:none;
mso-hide:all;}


/* Teèkové povely jsou oznaèené tady */
p.QuarxObycejnyText
{mso-style-name:QuarxObycejnyText;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxPovel;
font-size:12.0pt;
margin-top:0pt;
margin-right:0pt;
margin-left:1.0cm;
margin-bottom:0pt;
font-family:"Courier New";}


/* Tady je speciální oznaèení nalezeného textu */

span.QuarxFound
{mso-style-name:QuarxFound;
background:pink;}

span.QuarxNalezenyText
{mso-style-name:QuarxNalezenyText;
background:yellow;
border:1px solid lime;}



--
This e-mail address is fake, to keep spammers and their address
harvesters out
of my hair. If you want to get in touch personally, I am 'pdanes'
and I use
yahoo mail. But please use the newsgroup when possible, so that all
may
benefit from the exchange of ideas.
 
P

Petr Danes

Yes, modern vintages of Word are the target. I've looked up
WordProcessingML, seems a bit more straighforward than either RTF or my HTML
attempt, and more compact as well. Thanks for the tip, I'd never heard of
WordProcessingML, but at the moment it seems the most promising route.

Pete




Peter Jamieson said:
If you only need to target Word 2003 or later it might be better to emit
WordProcessingML text rather than RTF, particularly if the formatting
requirements are fairly simple. Although I wouldn't as it's particularly
easy to grasp how the style stuff works in WordProcessingML, you're more
likely to be able to re-use existing XML knowledge and XML-related tools.


Peter Jamieson

http://tips.pjmsn.me.uk

Petr said:
I'm looking at the RTF specs. Whew, they're complicated. Maybe if I
generate my text once, then ask word to save it as an RTF file and
examine the result, it will shed some light on the subject. I'll try that
next.

Yes, automation is the natural choice and is the first thing I tried. It
worked, quite well in fact, but was simply too slow to be practical.

I'm not sure I understand you regarding the template issue. I do have a
custom template, in fact, it's stored in the database as a blob and
written into the temp directory if it's not already there. Same with the
CSS file. The intention was to make the database completely
self-contained, that is, one-file portable. I know how to break the
AttachedTemplate link from the document, but this sounds like there may
be more. Is there some tie between a custom template and Normal.DOT? If
so, what do I do about it?

Pete




Sylvain Lafontaine said:
Sorry, but I've no idea why CSS/HTML is giving you so much trouble.
Personally, I don't use it for Word and I would probably use Automation
if I ever had to create a Word document. However, as this solution
seems to be to slow in your case, suggesting to take a look at the RTF
format seems to be a promising path.

I've also noticed that you are using a template to create your new
document and that this document is probably using the standard
Normal.DOT file for its basic formatting. Maybe one of these is the
source of your problem.

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


Hm, hadn't thought of the RTF path. I'll have to study the specs and
see if it can do everything I need. It looks promising, I had no idea
that RTF was such a capable format. Including all the formatting inline
may bulk the file a bit, but I'll give it a try.

Still, the CSS/HTML route should work as well. Any ideas why it's
giving me so much trouble?

As for the Range.InsertFile, I forget now exactly why I did it that
way, rather than simply opening a file, but there was a reason. I think
maybe it was because the Open command opens a new document each time it
is called, causing them to pile up when doing multiple searches.



"Sylvain Lafontaine" <sylvain aei ca (fill the blanks, no spam please)>
pí¹e v diskusním pøíspìvku
Instead of using Range.InsertFile, maybe you should open the HTML
document as an independant word document and then transfert it to the
real document. For an example, see:

http://www.bokebb.com/dev/english/1990/posts/199082985.shtml

Also, this example is about using a RTF document instead of using
HTML; maybe you should do the same and use RTF instead of HTML. I
won't be surprisde if you have a better control over your RTF
documents than over an HTML document.

References on RTF:

http://en.wikipedia.org/wiki/Rich_Text_Format

http://www.microsoft.com/downloadS/...8D-FF06-4207-B476-6B5396A18A2B&displaylang=en

http://www.planet-source-code.com/vb/scripts/ShowCode.asp?lngWId=4&txtCodeId=6920

--
Sylvain Lafontaine, ing.
MVP - Technologies Virtual-PC
E-mail: sylvain aei ca (fill the blanks, no spam please)


Does anyone have any experience with loading a document -INTO-Word
using HTML and a cascading style sheet? All the stuff I have found in
the archives deals with exporting Word docs to HTML - I want to do
the opposite.

I have an ACCESS database that does lookups and uses VBA to create a
Word document detailing the results. Initially, I had the database
using a Word template to create the document, but the process was too
slow to be useful, so I converted it to write out plain text HTML,
with references to a cascading style sheet. The results are mixed.
Speed is much improved, but Word's use of the styles I define in the
CSS are hit and miss. A sample few lines of the generated HTML text
and the entire style sheet are reproduced at the end of this post.

The basic definition, the first style, named QuarxZakladOdstavec does
not appear at all in the created Word document, unless I add some
unnecessary text specifically using that style. The subsequent
definitions, which I would like to be based on this first one are
not, but are based on Normal. Some of the graphic definitions,
specifically margins, seem to be ignored completely. The styles are
affected by whatever styles are already present in Word, in fact,
they seem to take precedence over those defined in the CSS file, and
I have to run some VBA code which deletes all 'Quarx' styles before
some changes take effect. (But not all, some CSS styles do take
effect next time the HTML file is loaded, even if the old style
remains.) The Access code opens a Word template, which uses this line
to load the HTML file:
doc.Range.InsertFile FileName:="abc.htm"
if that makes any difference.

Word is capable of creating this stuff from its native files as well
as reading files in this and other formats, but my results seem
almost random. If anyone can shed some light on this, or maybe even
suggest a different approach altogether, I'd appreciate some
thoughts.

Pete



=====================================================
Beginning of generated HTML text file:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"
<head>
<title>Class and ID Selectors</title>
<meta http-equiv="Content-Type"
content="text/xhtml;charset=windows-1250"/>
<link rel='stylesheet' type='text/css' href='C:\Users\Petr
Danes\AppData\Local\Temp\QuarxStylesheet 2008-12-16_14-29-12.css'/>
</head>
<body >
<p class='QuarxZakladOdstavec'>
ABCEDFG
<p class='QuarxHS'>
._HS Gottaischer [C:\Palma\T602\Hyper\A
test\BATEL\BATELOV.TXT] {001}
</p>
<p class='QuarxPovel'>
.AU
</p>
<p class='QuarxAutor'>
Gottaischer
</p>
<p class='QuarxPovel'>
.TI
</p>
<p class='QuarxObycejnyText'>
Gottaischer Hofkalender fuer 1779, 1780.
</p>
<p class='QuarxPovel'>
.IM
</p>
<p class='QuarxObycejnyText'>
Goth a, s. t., 1779, 1780, 110, 175 s., 8´.
</p>
<p class='QuarxPovel'>
.RO
</p>
<p class='QuarxObycejnyText'>

</p>
<p class='QuarxPovel'>

<!--



Entire CSS file

/* Style Definitions */

/* Tohle je základ pro v¹echny dal¹í styly, pou¾ité pro rùzná
oznaèení */

p.QuarxZakladOdstavec
{mso-style-name:QuarxZakladOdstavec;
mso-style-parent:"Normal";
mso-pagination:widow-orphan;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-family:"Courier New";}

/* Autor, signatura a datum jsou speciálnì oznaèené, aby byly rychle
vidìt */

p.QuarxAutor
{mso-style-name:QuarxAutor;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:red;
font-weight:bold;}
p.QuarxSignatura
{mso-style-name:QuarxSignatura;
mso-style-parent:QuarxZakladOdstavec;
color:blue;
font-weight:bold;}
p.QuarxDatum
{mso-style-name:QuarxDatum;
mso-style-parent:QuarxZakladOdstavec;
color:#44BB44;
font-weight:bold;
text-decoration:underline;
text-underline:single;}
p.QuarxProvenience
{mso-style-name:QuarxProvenience;
mso-style-parent:QuarxZakladOdstavec;
font-size:12.0pt;
margin-top:0pt;
margin-bottom:0pt;
font-weight:bold;}

/* Záhlaví, oznaèené pomocí ._HS, je barvené podle toho, jestli heslo
obsahuje nebo neobsahuje hledaný text */

p.QuarxHS
{mso-style-name:QuarxHS;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
page-break-before:always;
mso-border-top-alt:solid black 0.5pt;
tab-stops:right 468.0pt;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#999999;}


/* Teèkové povely jsou oznaèené tady */

p.QuarxPovel
{mso-style-name:QuarxPovel;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxZakladOdstavec;
font-size:8.0pt;
margin-top:0pt;
margin-bottom:0pt;
color:#33CCCC;
display:none;
mso-hide:all;}


/* Teèkové povely jsou oznaèené tady */
p.QuarxObycejnyText
{mso-style-name:QuarxObycejnyText;
mso-style-parent:QuarxZakladOdstavec;
mso-style-next:QuarxPovel;
font-size:12.0pt;
margin-top:0pt;
margin-right:0pt;
margin-left:1.0cm;
margin-bottom:0pt;
font-family:"Courier New";}


/* Tady je speciální oznaèení nalezeného textu */

span.QuarxFound
{mso-style-name:QuarxFound;
background:pink;}

span.QuarxNalezenyText
{mso-style-name:QuarxNalezenyText;
background:yellow;
border:1px solid lime;}



--
This e-mail address is fake, to keep spammers and their address
harvesters out
of my hair. If you want to get in touch personally, I am 'pdanes' and
I use
yahoo mail. But please use the newsgroup when possible, so that all
may
benefit from the exchange of ideas.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top