473,729 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using Word Automation to get Heading/Outline Numbers

I have a document in the following style

1 Introduction
2 Next Heading
2.1 Sub-section
Some text ...
2.2 Another Sub-section
2.2.1 Getting deeper
3 Another Major Heading
....

My final aim is to iterate through the document in VB.NET, pick out the
headings and text and create a cleaned-up, normalised XML document.

At the moment, I am iterating through the paragraphs in the document, just
picking out the headings. When I look at the text of the heading it does not
include the heading number (which is fair enough). But, how do I retrieve
the heading number? Each heading is formatted with the appropriate heading
style for its level, so "Introducti on" is Heading 1, "Getting deeper" id
Heading 3, and so on.

I could look at the outline level and work it for myself, but I presume that
Word knows what number it is going to give to a heading, and it is this
number I would like to get at.

TIA

Charles
Nov 21 '05 #1
5 5684
This may help
http://www.devx.com/dotnet/Article/17358?trk=DXRSS_XML
"Charles Law" <bl***@nowhere. com> wrote in message
news:uv******** *****@TK2MSFTNG P11.phx.gbl...
I have a document in the following style

1 Introduction
2 Next Heading
2.1 Sub-section
Some text ...
2.2 Another Sub-section
2.2.1 Getting deeper
3 Another Major Heading
...

My final aim is to iterate through the document in VB.NET, pick out the
headings and text and create a cleaned-up, normalised XML document.

At the moment, I am iterating through the paragraphs in the document, just
picking out the headings. When I look at the text of the heading it does not
include the heading number (which is fair enough). But, how do I retrieve
the heading number? Each heading is formatted with the appropriate heading
style for its level, so "Introducti on" is Heading 1, "Getting deeper" id
Heading 3, and so on.

I could look at the outline level and work it for myself, but I presume that
Word knows what number it is going to give to a heading, and it is this
number I would like to get at.

TIA

Charles

Nov 21 '05 #2
Hi Mark

Thanks for the reply. I had seen that in fact; I think it was posted in
another thread that I stumbled into.

I have used it as my starting point for creating an xml file, and it helps
me to get things like the style name and page numbers. but unfortunately it
falls short of extracting the outline number of a paragraph.

Charles
"Mark Jones" <no************ **@devnullbucke t.org> wrote in message
news:41******** *************** @news.twtelecom .net...
This may help
http://www.devx.com/dotnet/Article/17358?trk=DXRSS_XML
"Charles Law" <bl***@nowhere. com> wrote in message
news:uv******** *****@TK2MSFTNG P11.phx.gbl...
I have a document in the following style

1 Introduction
2 Next Heading
2.1 Sub-section
Some text ...
2.2 Another Sub-section
2.2.1 Getting deeper
3 Another Major Heading
...

My final aim is to iterate through the document in VB.NET, pick out the
headings and text and create a cleaned-up, normalised XML document.

At the moment, I am iterating through the paragraphs in the document,
just
picking out the headings. When I look at the text of the heading it does
not
include the heading number (which is fair enough). But, how do I retrieve
the heading number? Each heading is formatted with the appropriate
heading
style for its level, so "Introducti on" is Heading 1, "Getting deeper" id
Heading 3, and so on.

I could look at the outline level and work it for myself, but I presume
that
Word knows what number it is going to give to a heading, and it is this
number I would like to get at.

TIA

Charles


Nov 21 '05 #3
I suppose another option is to use the table of contents object exposed by word to set up
your XML structure.

"Charles Law" <bl***@nowhere. com> wrote in message
news:OF******** ******@tk2msftn gp13.phx.gbl...
Hi Mark

Thanks for the reply. I had seen that in fact; I think it was posted in
another thread that I stumbled into.

I have used it as my starting point for creating an xml file, and it helps
me to get things like the style name and page numbers. but unfortunately it
falls short of extracting the outline number of a paragraph.

Charles
"Mark Jones" <no************ **@devnullbucke t.org> wrote in message
news:41******** *************** @news.twtelecom .net...
This may help
http://www.devx.com/dotnet/Article/17358?trk=DXRSS_XML
"Charles Law" <bl***@nowhere. com> wrote in message
news:uv******** *****@TK2MSFTNG P11.phx.gbl...
I have a document in the following style

1 Introduction
2 Next Heading
2.1 Sub-section
Some text ...
2.2 Another Sub-section
2.2.1 Getting deeper
3 Another Major Heading
...

My final aim is to iterate through the document in VB.NET, pick out the
headings and text and create a cleaned-up, normalised XML document.

At the moment, I am iterating through the paragraphs in the document,
just
picking out the headings. When I look at the text of the heading it does
not
include the heading number (which is fair enough). But, how do I retrieve
the heading number? Each heading is formatted with the appropriate
heading
style for its level, so "Introducti on" is Heading 1, "Getting deeper" id
Heading 3, and so on.

I could look at the outline level and work it for myself, but I presume
that
Word knows what number it is going to give to a heading, and it is this
number I would like to get at.

TIA

Charles



Nov 21 '05 #4
Yes, a possibility, but I think it is probably maintained independently of
the body of the document, and so could get out of sync. It could also turn
into a sorting exercise, where I traverse the document and attempt to
pigeon-hole each heading as I encounter it.

Charles
"Mark Jones" <no************ **@devnullbucke t.org> wrote in message
news:41******** *************** @news.twtelecom .net...
I suppose another option is to use the table of contents object exposed by
word to set up
your XML structure.

"Charles Law" <bl***@nowhere. com> wrote in message
news:OF******** ******@tk2msftn gp13.phx.gbl...
Hi Mark

Thanks for the reply. I had seen that in fact; I think it was posted in
another thread that I stumbled into.

I have used it as my starting point for creating an xml file, and it
helps
me to get things like the style name and page numbers. but unfortunately
it
falls short of extracting the outline number of a paragraph.

Charles
"Mark Jones" <no************ **@devnullbucke t.org> wrote in message
news:41******** *************** @news.twtelecom .net...
> This may help
> http://www.devx.com/dotnet/Article/17358?trk=DXRSS_XML
>
>
> "Charles Law" <bl***@nowhere. com> wrote in message
> news:uv******** *****@TK2MSFTNG P11.phx.gbl...
>> I have a document in the following style
>>
>> 1 Introduction
>> 2 Next Heading
>> 2.1 Sub-section
>> Some text ...
>> 2.2 Another Sub-section
>> 2.2.1 Getting deeper
>> 3 Another Major Heading
>> ...
>>
>> My final aim is to iterate through the document in VB.NET, pick out
>> the
>> headings and text and create a cleaned-up, normalised XML document.
>>
>> At the moment, I am iterating through the paragraphs in the document,
>> just
>> picking out the headings. When I look at the text of the heading it
>> does
>> not
>> include the heading number (which is fair enough). But, how do I
>> retrieve
>> the heading number? Each heading is formatted with the appropriate
>> heading
>> style for its level, so "Introducti on" is Heading 1, "Getting deeper"
>> id
>> Heading 3, and so on.
>>
>> I could look at the outline level and work it for myself, but I
>> presume
>> that
>> Word knows what number it is going to give to a heading, and it is
>> this
>> number I would like to get at.
>>
>> TIA
>>
>> Charles
>>
>>
>
>



Nov 21 '05 #5
I have just discovered where it is:

For any paragraph 'p' in the document, the heading number is contained in

p.Range.ListFor mat.ListString

I hope someone else will find this useful.

Charles
"Charles Law" <bl***@nowhere. com> wrote in message
news:uv******** *****@TK2MSFTNG P11.phx.gbl...
I have a document in the following style

1 Introduction
2 Next Heading
2.1 Sub-section
Some text ...
2.2 Another Sub-section
2.2.1 Getting deeper
3 Another Major Heading
...

My final aim is to iterate through the document in VB.NET, pick out the
headings and text and create a cleaned-up, normalised XML document.

At the moment, I am iterating through the paragraphs in the document, just
picking out the headings. When I look at the text of the heading it does
not include the heading number (which is fair enough). But, how do I
retrieve the heading number? Each heading is formatted with the
appropriate heading style for its level, so "Introducti on" is Heading 1,
"Getting deeper" id Heading 3, and so on.

I could look at the outline level and work it for myself, but I presume
that Word knows what number it is going to give to a heading, and it is
this number I would like to get at.

TIA

Charles

Nov 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
6557
by: Michael G. Schneider | last post by:
I know that using Word Automation inside an ASP page is no good idea. Anything I want to do in the current project is: open document, change some text, save and close document. Basically changing some variables, consting of a name embraced by special chars, to some value. As for example: change "" to "Michael". Does anybody know whether there is a way for achieving this with basic "file input / output". Can I regard a Word document as...
0
1230
by: Stephane Belzile | last post by:
Hi, I've seen a lot of people having that same problem trying to instantiate a word.application com object from an asp.net application. I have built a WEB application that is used to manage the creation of an annual report from 75 different word documents. I'm using word automation to activate the Revison Tracking flag when I send a word document to someone. I had the Access denied error message and I have been able to get rid of it...
2
3839
by: JP SIngh | last post by:
HI All I just wonder if anyone has created a word document using ASP. I am able to create a work document with ASP without any problem but what I want to do is slightly more than I know. I am sure someone where will know how to do the following. We have a Word Template which is our standard contract type. I have some data stored my access database record. I want to merge the two together.
4
7681
by: Daniel | last post by:
Hello, i have a problem with the word automation from c#. First, i want to mention, that i don't have any dependencies from word in my c#-project, i want to use the system.reflection model to handle the automation. So, i'm using the following code to create a new word document: ---Code---
1
1472
by: Rachel | last post by:
I have just started to rewrite an application using ASP.NET. One of the main features of the application is automated letter production. In the old application this had been accomplished using Word Automation and mail merge. There doesn't seem to be very much information on the net on how to accomplish this in ASP.NET. Can anyone point me in the right direction? Rachel.
1
1949
by: Rachel | last post by:
I have just started to rewrite an application using ASP.NET. One of the main features of the application is automated letter production. In the old application this had been accomplished using Word Automation and mail merge. There doesn't seem to be very much information on the net on how to accomplish this in ASP.NET. Can anyone point me in the right direction? Rachel.
1
1537
by: Jay | last post by:
Hi, I have been using word automation with .Net framework 1.1 and it works fine with windows services but when i use the same code on .Net framework 2.0 it is not able to destroy the component. So when it tries to destroy the document component it throws an error. Please any one can tell why is this happening???? i am stuck on this and have to finish this ASAP..
0
1264
gemmountain
by: gemmountain | last post by:
Hi, does anyone know how to use Word Automation to insert page numbers for each section in a Word document, and the numbering scheme of each section is independent, not the same as previous? Suppose that my Word document have 3 sections: Section 1: 3 pages Section 2: 2 pages Section 3: 4 pages So i want my pages number are: The first 3 pages (section 1) page number is 1,2,3 next 2 pages (section 2): number 1, 2
2
1245
by: SaubhagyaID | last post by:
How can I translate words from one language to another (say English to German) using MS Word proofing tools through MS Word automation in C# ? I want to give single word (or text) as input and get its translated word (or text) as output.
0
8921
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8763
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9148
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8151
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6722
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4528
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4796
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3238
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2165
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.