Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Headers and Footers in Main Body with Table Breaks
Hello All,
I am a new to VBA or programming, but felt this was the right group to post my question on. I want to do this one task in MS Word and felt that VBA would the best to go along with it. Correct me if I am wrong in any of the above statements. I am using Word 2003. Task: I have a multipage document in .rtf format. This document has table in it which occupies more than a page. All pages will have header and footer. I want to remove this header and footer and put the text in them in the main document one every page- at the top of each page for the header and bottom of each page for footer. If there is a table spanning more than a page, then I need to break the table at the appropriate point (which should depend upon the size of the header and the footer) and continue the table on the next page after the header on page -2. Trying to put things in a simpler way: Lets say I have a document with 3 pages. The document has header and footer on every page. The content of the document is a long table spanning all 3 pages. Eg: Header(page1) Page1 Table Footer Header(page2) Page2 Table Footer Header(page3) Page3 Table Footer. I want to convert this to : No Header Text(from header) - Table - Text(from footer) No Footer in Page1 No Header Text(from header) - Table - Text(from footer) No Footer in Page2 No Header Text(from header) - Table - Text(from footer) No Footer in Page3 and the same in page 4 if the table happens to go to it. I recorded some related macros and looked at the VB code generated, but it was way outside my box to understand what was going on. Any help would be appreciated. Best Regards, Sanket |
#2
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Headers and Footers in Main Body with Table Breaks
Hi Again,
I forgot to mention that I tried to post the same question to the Tables and NewUser groups - but luckily have not been successful. I was reading the posting ethics and tips and found I should nto be positng to other groups. Thanks in advance. "NewUser_Sanket" wrote: Hello All, I am a new to VBA or programming, but felt this was the right group to post my question on. I want to do this one task in MS Word and felt that VBA would the best to go along with it. Correct me if I am wrong in any of the above statements. I am using Word 2003. Task: I have a multipage document in .rtf format. This document has table in it which occupies more than a page. All pages will have header and footer. I want to remove this header and footer and put the text in them in the main document one every page- at the top of each page for the header and bottom of each page for footer. If there is a table spanning more than a page, then I need to break the table at the appropriate point (which should depend upon the size of the header and the footer) and continue the table on the next page after the header on page -2. Trying to put things in a simpler way: Lets say I have a document with 3 pages. The document has header and footer on every page. The content of the document is a long table spanning all 3 pages. Eg: Header(page1) Page1 Table Footer Header(page2) Page2 Table Footer Header(page3) Page3 Table Footer. I want to convert this to : No Header Text(from header) - Table - Text(from footer) No Footer in Page1 No Header Text(from header) - Table - Text(from footer) No Footer in Page2 No Header Text(from header) - Table - Text(from footer) No Footer in Page3 and the same in page 4 if the table happens to go to it. I recorded some related macros and looked at the VB code generated, but it was way outside my box to understand what was going on. Any help would be appreciated. Best Regards, Sanket |
#3
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Headers and Footers in Main Body with Table Breaks
At a simple level, it can't be done, although a contrived solution could
probably be found. What is the purpose of this? -- Enjoy, Tony "NewUser_Sanket" wrote in message ... Hi Again, I forgot to mention that I tried to post the same question to the Tables and NewUser groups - but luckily have not been successful. I was reading the posting ethics and tips and found I should nto be positng to other groups. Thanks in advance. "NewUser_Sanket" wrote: Hello All, I am a new to VBA or programming, but felt this was the right group to post my question on. I want to do this one task in MS Word and felt that VBA would the best to go along with it. Correct me if I am wrong in any of the above statements. I am using Word 2003. Task: I have a multipage document in .rtf format. This document has table in it which occupies more than a page. All pages will have header and footer. I want to remove this header and footer and put the text in them in the main document one every page- at the top of each page for the header and bottom of each page for footer. If there is a table spanning more than a page, then I need to break the table at the appropriate point (which should depend upon the size of the header and the footer) and continue the table on the next page after the header on page -2. Trying to put things in a simpler way: Lets say I have a document with 3 pages. The document has header and footer on every page. The content of the document is a long table spanning all 3 pages. Eg: Header(page1) Page1 Table Footer Header(page2) Page2 Table Footer Header(page3) Page3 Table Footer. I want to convert this to : No Header Text(from header) - Table - Text(from footer) No Footer in Page1 No Header Text(from header) - Table - Text(from footer) No Footer in Page2 No Header Text(from header) - Table - Text(from footer) No Footer in Page3 and the same in page 4 if the table happens to go to it. I recorded some related macros and looked at the VB code generated, but it was way outside my box to understand what was going on. Any help would be appreciated. Best Regards, Sanket |
#4
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Headers and Footers in Main Body with Table Breaks
What you are trying to do is very difficult. It runs counter to the way Word
is designed to work. Headers and footers are intended to be multi-page creations, often reflecting information that shows up in pages using the StyleRef field. Word doesn't really understand or use pages, as such. They are print-time constructs. If you can tell us why you are doing this, I suspect someone can tell you how to accomplish what you want using Word's features rather than fighting them. By the way, you'll probably want to try posting in the vba.beginners newsgroup instead, since it is a vba question. Final comment, learn how Word works before you try to program it. Otherwise you will either spend a lot of time writing code to do something that Word already does very well or you'll end up fighting with Word, having it seem to undo what you are attempting. While this learning process may take a bit of time, within in relatively short time, you'll be saving hours, days, or even weeks of effort. -- Charles Kenyon Word New User FAQ & Web Directory: http://addbalance.com/word Intermediate User's Guide to Microsoft Word (supplemented version of Microsoft's Legal Users' Guide) http://addbalance.com/usersguide See also the MVP FAQ: http://word.mvps.org/FAQs/ which is awesome! --------- --------- --------- --------- --------- --------- This message is posted to a newsgroup. Please post replies and questions to the newsgroup so that others can learn from my ignorance and your wisdom. "NewUser_Sanket" wrote in message ... Hello All, I am a new to VBA or programming, but felt this was the right group to post my question on. I want to do this one task in MS Word and felt that VBA would the best to go along with it. Correct me if I am wrong in any of the above statements. I am using Word 2003. Task: I have a multipage document in .rtf format. This document has table in it which occupies more than a page. All pages will have header and footer. I want to remove this header and footer and put the text in them in the main document one every page- at the top of each page for the header and bottom of each page for footer. If there is a table spanning more than a page, then I need to break the table at the appropriate point (which should depend upon the size of the header and the footer) and continue the table on the next page after the header on page -2. Trying to put things in a simpler way: Lets say I have a document with 3 pages. The document has header and footer on every page. The content of the document is a long table spanning all 3 pages. Eg: Header(page1) Page1 Table Footer Header(page2) Page2 Table Footer Header(page3) Page3 Table Footer. I want to convert this to : No Header Text(from header) - Table - Text(from footer) No Footer in Page1 No Header Text(from header) - Table - Text(from footer) No Footer in Page2 No Header Text(from header) - Table - Text(from footer) No Footer in Page3 and the same in page 4 if the table happens to go to it. I recorded some related macros and looked at the VB code generated, but it was way outside my box to understand what was going on. Any help would be appreciated. Best Regards, Sanket |
#5
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Headers and Footers in Main Body with Table Breaks
Hello Tony, Charles and others,
Both of you have asked me the purpose of my task. I work with SAS programming language and SAS creates reports in RTF format. Now these reports are individual tables which are on average 3-4 pages long. With SAS, we put the title of the table in the header part of the RTF and some footnotes in the footer part. Lets say in an average there are 100 such reports. In the end we haave to join all of them and still retain the Table titles and footnotes (as per table) on each relevant page. Also, the final document will have a different header and footer. Now because there are different headers and fo oters from these 100 diferent reports, it is a pian with merging them into one. The task I want to accomplish is for the header from the document to be a part of the main document in each report and likewise with the footers. The table has to break itself accordingly and get the header into the document and the footer below it in every page and the header and footer should be deleted. This way when the document is merged with others, the final document will retain the table names and footnotes for each table, while at the same time can have a common header and footer throughout. I hope I have been clear. Best regards, Sanket |
#6
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Headers and Footers in Main Body with Table Breaks
Hi Sanket,
Basically what you want can't be done the way you suggest - and it means you pre-empting Word's pagination and hoping that you get it right. What you seem to want is some kind of report generation tool with multiple levels of header and footer - unfortunately Word doesn't do this. Before offering you a way of doing it might I suggest an alternative avenue for investigation. I can't be precise without seeing exactly what you're working with but consider putting each table in a separate section. Each section can have its own headers and footers. The awkward bit here might be adding your common headers and footers to the beginning and end respectively of every section header and footer - but the end result ought to be what you want. Also before going any further - are your footers footers or footnotes - the two are different and footnotes will print at the bottom of the page before the page footer all by themselves. Now for the promised way of putting non-table content in the middle of a table without breaking the table into multiple smaller tables: Insert a textbox in the first cell on the first row on the page. In the Textbox Format Dialog, select the Colours and Lines tab and Set the Line Colour to "No Line" In the Textbox Format Dialog, select the Layout tab and click on Advanced In the Text Wrapping tab, select "Top and Bottom" wrapping In the Picture Position tab ... Uncheck "Layout in Table Cell" Set the Horizontal Absolute Position to, probably, zero to the right of the cell Set the Vertical Absolute Position to zero or a negative number Size your textbox to fit your header Enter your header content in the textbox Pray. Do someting similar for the footer Pray again. Repeat for every page. There are variations on this theme that you can try. What you will find the most awkward (especially programmatically) will be determining exactly which rows will fall either side of the page breaks. Good luck! -- Enjoy, Tony "NewUser_Sanket" wrote in message ... Hello Tony, Charles and others, Both of you have asked me the purpose of my task. I work with SAS programming language and SAS creates reports in RTF format. Now these reports are individual tables which are on average 3-4 pages long. With SAS, we put the title of the table in the header part of the RTF and some footnotes in the footer part. Lets say in an average there are 100 such reports. In the end we haave to join all of them and still retain the Table titles and footnotes (as per table) on each relevant page. Also, the final document will have a different header and footer. Now because there are different headers and fo oters from these 100 diferent reports, it is a pian with merging them into one. The task I want to accomplish is for the header from the document to be a part of the main document in each report and likewise with the footers. The table has to break itself accordingly and get the header into the document and the footer below it in every page and the header and footer should be deleted. This way when the document is merged with others, the final document will retain the table names and footnotes for each table, while at the same time can have a common header and footer throughout. I hope I have been clear. Best regards, Sanket |
#7
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Headers and Footers in Main Body with Table Breaks
Hi Tony, I might not have been very clear in my previous post. The purpose of merging different documents with multiple headers and footers is not my goal. I am working with only one document at a time. When saying this I mean that the document has only one header, one footer and one table. My task is to get the text of the header part and put it as text above the table. Then to blank out the header - as in delete the text within it (not delete the header itself). Copy footer information as a footnote. Blank out the footer - as in delete the text within it (not delete the footer itself). Do the same on every page. i.e. paste the same header and footer above and below the table. I will need to create a macro for this. So will have to code it in VBA, I guess. If it is not possible to do it, I might as well not attempt it. But somehow I feel that my task is not going against the word pagination but just about cut-paste text from header and footer and about table breaks and page breaks at right locations. To do it programmatically is still a monumental task for me. Please advice. Best regards, Sanket |
#8
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Headers and Footers in Main Body with Table Breaks
I think it would help if we understood why you need to do this. Is this in
order to convert the document to .txt or .htm format (in which headers and footers are not retained)? -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Sanket" wrote in message news Hi Tony, I might not have been very clear in my previous post. The purpose of merging different documents with multiple headers and footers is not my goal. I am working with only one document at a time. When saying this I mean that the document has only one header, one footer and one table. My task is to get the text of the header part and put it as text above the table. Then to blank out the header - as in delete the text within it (not delete the header itself). Copy footer information as a footnote. Blank out the footer - as in delete the text within it (not delete the footer itself). Do the same on every page. i.e. paste the same header and footer above and below the table. I will need to create a macro for this. So will have to code it in VBA, I guess. If it is not possible to do it, I might as well not attempt it. But somehow I feel that my task is not going against the word pagination but just about cut-paste text from header and footer and about table breaks and page breaks at right locations. To do it programmatically is still a monumental task for me. Please advice. Best regards, Sanket |
#9
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Headers and Footers in Main Body with Table Breaks
Hi Sanket,
If it is not possible to do it, I might as well not attempt it. But somehow I feel that my task is not going against the word pagination but just about cut-paste text from header and footer and about table breaks and page breaks at right locations. The problem is, the right location is likely to change every time you switch printers, especially if a table ever gets edited. Page breaks in Word do not stay in place. Rather, you might try messing with your SAS program that generates the files to see if it can export the text differently. For instance, if the title of the table were exported as the first row of the table (instead of as a header), you might then be able to set that first row as a heading row to repeat on every page in Word, which should serve the purpose of showing the table title on every page. It's unclear to me whether the stuff at the bottom is footers or footnotes. Table footnotes should not be in a footer at all, but are usually at the bottom of the table. If the table footnotes are acting like a map legend, and need to be on every page, maybe try exporting them along with the title into the first row. Then you would just be able to merge the text documents programmatically. -- Daiya Mitchell, MVP Mac/Word Word FAQ: http://www.word.mvps.org/ MacWord Tips: http://word.mvps.org/Mac/WordMacHome.html What's an MVP? A volunteer! Read the FAQ: http://mvp.support.microsoft.com/ |
#10
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Headers and Footers in Main Body with Table Breaks
HI,
Its not to convert it into .htm or .txt format but for some later processing which cannot have any headers and footers in it. The information in the headers and footers for the document has to be retained though. So, thereby, I need to get the text out from the headers and footers and put it in the main part of the document - Header above the table and footer below the table on each page of the document. Thanks Sanket "Suzanne S. Barnhill" wrote: I think it would help if we understood why you need to do this. Is this in order to convert the document to .txt or .htm format (in which headers and footers are not retained)? -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Sanket" wrote in message news Hi Tony, I might not have been very clear in my previous post. The purpose of merging different documents with multiple headers and footers is not my goal. I am working with only one document at a time. When saying this I mean that the document has only one header, one footer and one table. My task is to get the text of the header part and put it as text above the table. Then to blank out the header - as in delete the text within it (not delete the header itself). Copy footer information as a footnote. Blank out the footer - as in delete the text within it (not delete the footer itself). Do the same on every page. i.e. paste the same header and footer above and below the table. I will need to create a macro for this. So will have to code it in VBA, I guess. If it is not possible to do it, I might as well not attempt it. But somehow I feel that my task is not going against the word pagination but just about cut-paste text from header and footer and about table breaks and page breaks at right locations. To do it programmatically is still a monumental task for me. Please advice. Best regards, Sanket |
#11
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Headers and Footers in Main Body with Table Breaks
If the information just needs to remain available, I would have thought that
once at the beginning of the table (header) and once at the end (footer) would suffice. -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Sanket" wrote in message ... HI, Its not to convert it into .htm or .txt format but for some later processing which cannot have any headers and footers in it. The information in the headers and footers for the document has to be retained though. So, thereby, I need to get the text out from the headers and footers and put it in the main part of the document - Header above the table and footer below the table on each page of the document. Thanks Sanket "Suzanne S. Barnhill" wrote: I think it would help if we understood why you need to do this. Is this in order to convert the document to .txt or .htm format (in which headers and footers are not retained)? -- Suzanne S. Barnhill Microsoft MVP (Word) Words into Type Fairhope, Alabama USA Word MVP FAQ site: http://word.mvps.org Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit. "Sanket" wrote in message news Hi Tony, I might not have been very clear in my previous post. The purpose of merging different documents with multiple headers and footers is not my goal. I am working with only one document at a time. When saying this I mean that the document has only one header, one footer and one table. My task is to get the text of the header part and put it as text above the table. Then to blank out the header - as in delete the text within it (not delete the header itself). Copy footer information as a footnote. Blank out the footer - as in delete the text within it (not delete the footer itself). Do the same on every page. i.e. paste the same header and footer above and below the table. I will need to create a macro for this. So will have to code it in VBA, I guess. If it is not possible to do it, I might as well not attempt it. But somehow I feel that my task is not going against the word pagination but just about cut-paste text from header and footer and about table breaks and page breaks at right locations. To do it programmatically is still a monumental task for me. Please advice. Best regards, Sanket |
#12
Posted to microsoft.public.word.pagelayout
|
|||
|
|||
Headers and Footers in Main Body with Table Breaks
Thanks for all your help. I have got a some code from the internet and modified it to get things going a bit. I am glad that things are working a bit, albiet slowly. Regards, Sanket |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Headers and footers printing different size on odd and even pages | Microsoft Word Help | |||
Problems with Heades and Footers | Microsoft Word Help | |||
Doc Template & headers and footers | Microsoft Word Help | |||
Headers & Footers | Microsoft Word Help | |||
Headers and section breaks | Page Layout |