PDA

View Full Version : Headers and Footers


DavidBaron
September 22, 2004, 19:27:17
Hi There,

I am using the ASP server version to dynamically build employee resumes out of our HR system. So far, so good, but now I have a problem with headers and footers. First off, I am trying to include a header and footer on each page. Basic stuff, like date, title and page in the header, and 'proprietary disclaimer' in the footer. Should be easy I would think. I have written the code, as best I can tell it should work, but nothing comes out. The rest of the resume works fine. Here is some code:

'all variables have already been dim'd
set lc = Server.CreateObject("TIS.TX.LicManager")
set tx = Server.CreateObject("TIS.TX.TextControl")
tx.EnableAutomationServer

twipInch = 1440

tx.FontName = "Arial"
tx.FontSize = "9"
tx.PageMarginT = .75 * twipInch
tx.PageMarginB = .75 * twipInch
tx.PageMarginR = .75 * twipInch
tx.PageMarginL = .75 * twipInch
tx.PageHeight = 11 * twipInch
tx.PageWidth = 8.5 * twipInch
tx.formatSelection = true
tx.HeaderFooter = 5 '1 for header plus 4 for footer

tx.selstart = -1

tx.HeaderFooterSelect 1 'txHeader
ClearTabs tx 'sub routine that gets rid of all tabs
tx.tabcurrent = 1
tx.tabPos = (tx.pagewidth - (tx.pageMarginL + tx.pageMarginR)) / 2
tx.tabtype = 3 'centered
tx.tabcurrent = 2
tx.tabPos = (tx.pagewidth - (tx.pageMarginL + 10)) 'twips
tx.tabType = 2 'right
tx.Text = formatdatetime(now,vbLongdate) & vbTab & "Talent Management Biography" & vbTab & "Page 1"

tx.HeaderFooterSelect 4 'txFooter
ClearTabs tx 'sub routine that gets rid of all tabs
tx.tabcurrent = 1
tx.tabPos = (tx.pagewidth - (tx.pageMarginL + tx.pageMarginR)) / 2
tx.tabtype = 3 'centered
tx.Text = vbTab & "Lockheed Martin Proprietary Information"

tx.HeaderFooterSelect 0
'then go on to create the rest of the resume document, which works great

So, my questions are: Should the above code correct? Nothing comes out anywhere.

Second question: Do I 'set' the header and footer just once, and then it comes out 'by itself' on every page? Or do I have to somehow manually put it on every page? I would imagine the former.

Also, how do I get 'rolling page numbers' to display in a header or footer? Is there some kind of special character?

Thanks,

-David

Björn Meyer
September 23, 2004, 13:14:15
Hello David

The code is okay and you don't have to insert a header on every page. You simply have to use anoher ViewMode. Please set the ViewMode property to 1.

tx.ViewMode = 1

In this case, headers and footers only can be processed.

DavidBaron
September 23, 2004, 19:27:36
That didn't seem to do anything. I still get no headers or footers. The rest of the document comes out great.

I placed the line of code you sent in the 'upper' area of the code block, *before* I set .HeaderFooter = 5

Do I need to set .ViewMode back to 0 after configuring the headers and footers?

Do I need to 'start' the main body text at a certain 'position' on the page?

How do I get 'progressing' page numbers in the headers?

DavidBaron
September 23, 2004, 20:33:53
Björn,

I have been playing more with this stuff, as well as looking deeper into the forum. It appears that even after setting tx.HeaderFooter = 5, it is still equal to zero. And I even put in tx.ViewMode = 1 *before* I set .HeaderFooter. Because the .HeaderFooter is zero, calling .HeaderFooterSelect always returns false. That's why I get no headers or footers.

What is the trick to enabling Headers and Footers?

If you look through the support forum enough, you will see that plenty of others have had similar problems. Maybe you guys could put out a sample that includes Headers and Footers that work with ASP. It seems obvious that there are some number of problems using Headers and Footers with ASP.

It is also somewhat confusing trying to figure out which Header and Footer methods and properties are actually necessary when using ASP. It would help if the documentation indicated which commands work for which products. Some commands obviously don't apply to ASP (unattended operation), but others are not so clear. For instance, .HeaderFooterActivate It *sounds* like you would use that in a VB app to 'activate' the header/footer region automatically for the user, i.e., turn the dotted-line border on for the header and 'disable' the page text. But I'm not sure I use it in ASP. I didn't put it in my original code, and you said my code was fine. But after researching the support forum a bit, I see that you have previously included that command in some of your answers. I tried it as well, but nothing happened, again, because .HeaderFooter = 0.

Sorry for the frustration, but it just seems so hard to do something that seems like it should be so easy.

Björn Meyer
September 24, 2004, 10:25:34
This is a simple way to insert them:

TX1.ViewMode = 1
TX1.HeaderFooter = 1
TX1.HeaderFooterSelect 1
TX1.SelText = "Header"
TX1.HeaderFooterSelect 0

DavidBaron
September 25, 2004, 00:27:30
Hi Björn,

I tried your sample code and it worked great. Then I put my own code back in and it worked great. Note that I did not put back *all* of my code, basically only what you had, plus the necessary tabs, formatting and data that I needed. I also put in Footers and they worked.

Then I tried setting the .HeaderFooterPosition(1) property, in an effort to move the headers and footers closer to the top/bottom of the page. That caused headers and footers to stop working again (the text appeared in the main body of the document). So, I took out my new lines. Headers and footers still didn't work. So I commented out all of my header/footer code and put your 4 lines of code back in. That still didn't work. I finally cycled the web services on my development web server and that fixed things again. It may be that if something 'breaks' the headers and footers, the DLL gets messed up somehow.

In any case they are working again. Please see my other post for page numbering. Thank your for hanging in there with me.

grsmith
September 29, 2004, 18:09:41
For what it is worth, I'm experiencing the same problem. Once the headerfooterselect returns false nothing I do short of recycling the web-service will fix the problem.

I've continued to investigate my problem with headers & footers and it appears related to placing images on a document in the headerfooter region. (see post "What determines HeaderFooterSelect = False posted 9/17/04"). The first time through everything works fine, however every subsequent call to the web-service headfooterselect always returns false and nothing works to reset it.