U++ framework
Do not panic. Ask here before giving up.

Home » U++ Library support » RichText,QTF,RTF... » page numbering
Re: page numbering [message #5261 is a reply to message #5256] Tue, 12 September 2006 01:09 Go to previous messageGo to previous message
zsolt is currently offline  zsolt
Messages: 704
Registered: December 2005
Location: Budapest, Hungary
Contributor
When using Report::Header(), the stylesheet data is shown also. This is because a bug in Report::FormatHF() method.

The original one was:
String  Report::FormatHF(const char *s, int pageno)
{
	String result;
	while(*s) {
		if(s[0] == '$' && s[1] == '$') {
			if(s[2] == 'P')
				result.Cat(Format("%d", pageno + 1));
			if(s[2] == 'D')
				result.Cat(Format(GetSysDate()));
			s += 3;
		}
		result.Cat(*s++);
	}
	return result;
}


And the fixed one is:
String  Report::FormatHF(const char *s, int pageno)
{
	String result;
	while(*s) {
		if(s[0] == '$' && s[1] == '$') {
			if(s[2] == 'P'){
				result.Cat(Format("%d", pageno + 1));
				s += 3;
			}
			if(s[2] == 'D'){
				result.Cat(Format(GetSysDate()));
				s += 3;
			}
		}
		result.Cat(*s++);
	}
	return result;
}

BTW, this code is very tricky Smile First I thought, this can generate a segfault. I'm learning every time when reading your code Smile
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: How to insert and display *.png file in UWord and/or qtf??
Next Topic: report / qtf to pdf saving
Goto Forum:
  


Current Time: Tue Jun 23 02:18:59 GMT+2 2026

Total time taken to generate the page: 0.00823 seconds