Getting font properties of text in between paragraphs

A

Abhishek

Hi!

I am writing a code that needs to get all the font changes done in a doc.
I am able to get the font of the paragraph with the Paragraph.range.font but
with this I am unable to get the font changes or variations in between the
paragraphs

I need to know of all the changes/settings done within the doc related to
font.

Abhishek
 
T

Tony Jollans

I'm not entirely sure what sort of result you want when you talk about font
_changes_, but there are two possible ways to find all fonts used in a
document ...

1) Check each character and see what font it is
2) Check each font and search the document for it

Which is better might depend on the document being checked and/or the number
of available fonts on the machine.
 
H

Helmut Weber

Hi Abhishek,

pretty complicated, to say the least.
I think, you might want to know about fonts,
which don't apply to some company standard, or so.

Get a list of all standard fonts.

Search for all of them,
check whether there are decorative fonts,
if so, remember the font name, if not in the standard fonts list,
otherwise delete.

For an example an how to get all fonts used in a doc,
even of fonts, which aren't installed on the actual machine,
see: http://tinyurl.com/dh54n
which isn't the whole truth by far.

Not to speak of fonts in fields,
and applied character styles.
And, beware of tables.
The code of the above mentioned link hangs, if there are tables.

Check all story ranges.
http://word.mvps.org/faqs/customization/ReplaceAnywhere.htm

IMHO, should be possible,
but I wonder, whether it's worth the effort.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 
A

Abhishek

Tony Jollans said:
I'm not entirely sure what sort of result you want when you talk about
font
_changes_, but there are two possible ways to find all fonts used in a
document ...

1) Check each character and see what font it is
How do I go about this?
I'll try and explain what exactly is my requirement
I need to form my own XML/HTML displaying only the textual part but with
complete formatting.
Therefore I need to know each place where font is changing or as you
mentioned Check each character and see what font it is

Here is an example of what I need
This is an XML generated from Word I need it simple format
<w:p>
- <w:r>
<w:t>This testing is for the conversion of Word doc to flash and also to
test for</w:t>
</w:r>
- <w:r>
- <w:rPr>
<w:b />
</w:rPr>
<w:t>BOLD</w:t>
</w:r>
- <w:r>
<w:t>and</w:t>
</w:r>
- <w:r>
- <w:rPr>
<w:i />
</w:rPr>
<w:t>ITALICS</w:t>
</w:r>
- <w:r>
<w:t>and this is</w:t>
</w:r>
- <w:r>
- <w:rPr>
<w:u w:val="single" />
</w:rPr>
<w:t>UNDERLINE</w:t>
</w:r>
- <w:r>
<w:t>and this is</w:t>
</w:r>
- <w:r>
- <w:rPr>
<w:b />
<w:i />
<w:u w:val="single" />
</w:rPr>
<w:t>BOLD,ITALICS,AND UNDERLINE</w:t>
</w:r>
</w:p>



I need it like

<p><font name="Times New Roman" size="10">This testing is for the conversion
of Word doc to flash and also to test for<b>BOLD</b>and
<i/> ITALICS</i>and this is<u> UNDERLINE</u>and this is
<b><i><u> BOLD,ITALICS,AND UNDERLINE</b></i></u></font></p>
 
T

Tony Jollans

I'm sorry I don't know enough about XML to help you but you seem to want
simple HTML. Have you tried saving as a web page and working with that
rather than the XML (or even looking at what is generated in the Script
Editor (Alt+Shift+F11))

--
Enjoy,
Tony


Abhishek said:
Tony Jollans said:
I'm not entirely sure what sort of result you want when you talk about
font
_changes_, but there are two possible ways to find all fonts used in a
document ...

1) Check each character and see what font it is
How do I go about this?
I'll try and explain what exactly is my requirement
I need to form my own XML/HTML displaying only the textual part but with
complete formatting.
Therefore I need to know each place where font is changing or as you
mentioned Check each character and see what font it is

Here is an example of what I need
This is an XML generated from Word I need it simple format
<w:p>
- <w:r>
<w:t>This testing is for the conversion of Word doc to flash and also to
test for</w:t>
</w:r>
- <w:r>
- <w:rPr>
<w:b />
</w:rPr>
<w:t>BOLD</w:t>
</w:r>
- <w:r>
<w:t>and</w:t>
</w:r>
- <w:r>
- <w:rPr>
<w:i />
</w:rPr>
<w:t>ITALICS</w:t>
</w:r>
- <w:r>
<w:t>and this is</w:t>
</w:r>
- <w:r>
- <w:rPr>
<w:u w:val="single" />
</w:rPr>
<w:t>UNDERLINE</w:t>
</w:r>
- <w:r>
<w:t>and this is</w:t>
</w:r>
- <w:r>
- <w:rPr>
<w:b />
<w:i />
<w:u w:val="single" />
</w:rPr>
<w:t>BOLD,ITALICS,AND UNDERLINE</w:t>
</w:r>
</w:p>



I need it like

<p><font name="Times New Roman" size="10">This testing is for the conversion
of Word doc to flash and also to test for<b>BOLD</b>and
<i/> ITALICS</i>and this is<u> UNDERLINE</u>and this is
<b><i><u> BOLD,ITALICS,AND UNDERLINE</b></i></u></font></p>
 

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