473,569 Members | 2,691 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

pyRTF and Footers

Hi All

I've been using the pyRTF module to generate some documents that I need
for work. In general, the module is good, and pretty simple to use.
However, I am running into a problem with footers that doesn't quite
make sense to me.

My question is this: Is it possible to change the text of a footer
throughout an RTF document?

The data that I am using to produce my document is organized in a
simple header/detail relationship. The document I want to produce
looks roughly like this:

---------------------------
USER001

detail data line 1
detail data line 2
detail data line 3

page footer that says "USER001, plus some other information"

**page break**

USER002

detail data line 1
detail data line 2
detail data line 3

page footer that says "USER002, plus some other information"

**page break**

USERnnn

detail data line 1
detail data line 2
detail data line 3

page footer that says "USERnnn, plus some other information"

END OF DOCUMENT

---------------------------

I've gotten everything the way I want, except for the footer. The
footer appears on the first page, but not on any other page.

The code that generates the footer is (apologies in advance for poor
style):

---------------------------

def MakeFooter(self , facilitatir, startDate, endDate, tuID):
section = Section()

self.doc.Sectio ns.append( section )

p = Paragraph( "%s - %s (%s - %s)" % ( facilitator, tuID,
startDate, endDate ), LINE )
p.append( 'Page', PAGE_NUMBER, ' of ', TOTAL_PAGES )
section.Footer. append( p )

---------------------------

The logic that calls MakeFooter is:

---------------------------

tuDoc = MakeTUDoc()
DR = Renderer()

for i in range( start, end + 1 ):
key = "Traininguser%0 3d" % ( i )
tuDoc.MakeFoote r( facilitator, startDate, endDate, key )
tuDoc.MakeHeade r( key, module )
< code to populate the document with detail data >

DR.Write( tuDoc.doc, tuDoc.OpenFile( 'JUNK' ) )

print( 'DONE!' )

---------------------------

(Note: the MakeHeader() method doesn't put an actual RTF header in the
document-- it just puts text in a Heading1 format into a section at the
top of the page, before the detail data.)

I had a look at the RTF 1.5 specification
(http://www.biblioscope.com/rtf15_spec.htm), and regarding headers and
footers and it's pretty thin. I didn't see anything in the
specification regarding support for changing footer text throughout the
document. Nothing in there that said I could do it, either.

Any ideas, anyone?

Thanks in advance. This is an extremely helpful discussion group.

-Doc

Nov 15 '06 #1
3 2582
At Wednesday 15/11/2006 20:08, E.********@gmai l.com wrote:
>I've been using the pyRTF module to generate some documents that I need
for work. In general, the module is good, and pretty simple to use.
However, I am running into a problem with footers that doesn't quite
make sense to me.
First, I don't use pyRTF. The app sketch and code snippet you have
posted look reasonable.
At least using Word, you can configure a page footer for each section
in the document, so I think it should be posible.
If you don't get the output you want, it may be a bug in the module,
you are using it in the wrong way, the feature is unsupported, etc.
but most likely not a bug in Python itself. So a better place to ask
would be... well, it appears there is no better place except asking
the author directly :)

(BTW, thanks for pointing me towards pyRTF - it may be useful, so
I'll give it a try...)
--
Gabriel Genellina
Softlab SRL

_______________ _______________ _______________ _____
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
Nov 15 '06 #2

Gabriel Genellina wrote:
At Wednesday 15/11/2006 20:08, E.********@gmai l.com wrote:
I've been using the pyRTF module to generate some documents that I need
for work. In general, the module is good, and pretty simple to use.
However, I am running into a problem with footers that doesn't quite
make sense to me.

First, I don't use pyRTF. The app sketch and code snippet you have
posted look reasonable.
Thanks :)
At least using Word, you can configure a page footer for each section
in the document, so I think it should be posible.
I edited the document in Word without problems. I put in several
different footers into my generated RTF document.
If you don't get the output you want, it may be a bug in the module,
=:-O
you are using it in the wrong way,
This is a possibility. I took a look at the raw RTF text, and the
multiple footers are in the text. I'm going to have to edit the
document with word and compare it to the original to see what the
difference is, I guess.
>...the feature is unsupported, etc.
Say it ain't so!
but most likely not a bug in Python itself.
=:-O
So a better place to ask would be... well, it appears there is no better place except asking
the author directly :)
Anyone got his number?
(BTW, thanks for pointing me towards pyRTF - it may be useful, so
I'll give it a try...)
It's very useful. I can see several applications in my job where I can
use this module.

Thanks

-Doc

Nov 15 '06 #3
At Wednesday 15/11/2006 21:01, E.********@gmai l.com wrote:
>I've been using the pyRTF module to generate some documents that I need
>for work. In general, the module is good, and pretty simple to use.
>However, I am running into a problem with footers that doesn't quite
>make sense to me.
So a better place to ask would be... well, it appears there is
no better place except asking
the author directly :)

Anyone got his number?
You could try the address listed in the docs...
I'm trying the examples and Example7 appears to be what you want.
--
Gabriel Genellina
Softlab SRL

_______________ _______________ _______________ _____
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar
Nov 16 '06 #4

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

Similar topics

2
1938
by: Web Surfer | last post by:
www.authoring.stylesheets] Is it possible to use stylesheets to override the Headers and Footers that are displayed on a printed webpage ?
2
6206
by: Rupe | last post by:
Hi CSS gurus! I have an embarassing problem. I am a php programmer and I try to expound the advantages of css on the php newsgroups. However, after telling someone that they should use css to solve their problem, I am having trouble coming up with the goods! + I would like to know the answer too.
28
14024
by: reneecccwest | last post by:
hello, how can I remove IE headers and footers when I print a page? I'd like to use a code to remove them, not thru the IE page setup. s/RC
3
1985
by: Chris Transcend | last post by:
Hi all, I'm writing my first .NET website and am wondering what the best method for including headers and footers is. I was thinking either a user or server control but am not sure which would be best performance-wise / maintenance wise. OR if there is another approach that is more commonly followed. I'm interested in performance mainly,...
1
2556
by: Kenneth | last post by:
Hi, In IE6 you can configure output to the printer getting a clean printout only with content, but without headers and footers. You remove the Header and Footer content from the Page Setup. But when you've done that, you have to know how to get those values back unless you've saved them somewhere for later retrieval. What I need is a way to...
7
6862
by: Robert Adkison | last post by:
I need to print a web page. It is my preference that my users just do a File/Print from explorer. That way my users will get the print dialog that will allow them to select the fax printer. The only problem with doing this is that a header (name of the page and Page x of x) and footer (actual page filename the date) are included. I am...
2
2462
by: Raja Raman Sundararajan | last post by:
Hello, I have been playing around with pyRTF module for generating rtf documents. Its a very nice tool that fits my basic needs. However I have a problem controlling cells in a table. I am not able to 1. do an align right of contents inside a cell 2. set backgroundcolor of a cell
0
1629
by: steve | last post by:
I am looking for a way to create dynamic headers and footers in a web form. There are .Net PDF products that convert web form content into PDF format and insert dynamic headers/footers. I'm just wondering if there is a similar way of accomplishing this in a web form by inserting a CSS page break. Is there a way to roughly limit each...
4
2813
by: ppuniversal | last post by:
Hi, I am developing an application in ASP .NET where I have to generate a Header and a Footer on my web pages. The issue is that, these headers and footers need to be dynamically placed on the page. For example, if the page length is 1 page, there will be only 1 header and 1 footer. But if the page length is larger, and when we do the print/print...
0
7612
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...
0
7922
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8119
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7668
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7964
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...
0
6281
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...
1
5509
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...
0
5218
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
936
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...

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.