OpenOffice.org Forum at OOoForum.orgThe OpenOffice.org Forum
 
 [Home]   [FAQ]   [Search]   [Memberlist]   [Usergroups]   [Register
 [Profile]   [Log in to check your private messages]   [Log in

SOLVED fields move left on print line

 
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer
View previous topic :: View next topic  
Author Message
STEVENSMITH100
General User
General User


Joined: 23 Sep 2010
Posts: 45
Location: United States

PostPosted: Sat Jun 16, 2012 12:31 pm    Post subject: SOLVED fields move left on print line Reply with quote

HEADAA
HEADBB

NAMEA
........................CELLA....................EMAILA
NAMEB
CELLB EMAILB
NAMEC
CELLC EMAILC
NAMED
CELLD EMAILD
NAMEE
CELLE EMAILE
NAMEF
….............. EMAILF < forced EMAILF to stay put
NAMEG
CELLG EMAILG
NAMEH
EMAILH < CELLH IS NULL or filled with blanks so EMAILH moves left
I am very new to programming in the 21st century so here goes.

Above is a part of the document I use to print a small report. When the report is printed the first column

“NAMEA”, NAMEB”, etc will be a persons name from a database.

The next column “CELLA”, “CELLB”, etc is for the phone number, and the last column

“EMAILA”, “EMAILB”, etc, is for their email address. The names of each field are in array's in the macro. (this also may be the worst way to go but for now I use it because I got it to work)

The problem I have is this. When a person does not have a phone number on file, when the phone # field is “empty” or if I fill up the field manually with blanks, the “EMAIL..” column will move over to the left as shown on the last row.

I filled one field with …......... for the entire length of the field and column # 3 stayed in place.

This is the first report I have tried to print where there were separate fields on the print line. AS you can see this posting would not keep the fields lined up either. I set blanks between each field on this post and the CELL & EMAIL fields moved left

There is much I don't know about this language but for now could someone tell me how to make a field

on a report stay in place when the field before it is blank or contains blanks at the end of said field.

I am “sure” it is a simple process, I think I skipped school that day.

I have tried several different ways but nothing I know how to do works.
Thank You Steven


Last edited by STEVENSMITH100 on Mon Jul 23, 2012 1:20 pm; edited 1 time in total
Back to top
View user's profile Send private message AIM Address
RPG
Super User
Super User


Joined: 24 Apr 2008
Posts: 2697
Location: Apeldoorn, Netherland

PostPosted: Sun Jun 17, 2012 2:05 am    Post subject: Reply with quote

Hello

I think it is better to use the other forum. There you upload examples. With an examples in code of your database it is more easy to give an answer to you

I have modified your code but I cannot test it but maybe you have now an idea how it can work. I think also a loop can make a more short code.

createReplaceDescriptor
I think this can only be done in a text document and not in a databasedocument

I have a question and that is: Why do you use a lot of macro and do not use the builtins. Maybe it is possible to do a lot of those things you want without macro. You can easy import a query in a spreadsheet and print that spreadsheet.

Romke

Code:
Sub Main
'(code in macro)
REM database name N_CENTRAL_DIRECTORY
Dim oProps(2) as New com.sun.star.beans.PropertyValue
DIM oOpts(1) as New com.sun.star.beans.PropertyValue
Dim oDoc as Object 'Document to print.
DIM S_Desc as OBJECT

'(code in macro)
HOLDLINE = LINEHOLD (1)
HOLDDATA = RESULTSET.GETSTRING(2)
CALL PRT_LINE HOLDLINE ,HOLDDATA
End Sub



'note: LINEHOLD () holds the field names used on the document


Sub PRT_LINE (HOLDLINE ,HOLDDATA)
'DIM HOLDLINE AS STRING
'DIM HOLDDATA AS STRING
DIM S_Desc AS OBJECT
DIM oDoc AS OBJECT
MSGBOX "OOO"
S_Desc = oDoc.createReplaceDescriptor() <<<<< error here
MSGBOX "PPP"
With S_Desc
.SearchString = HOLDLINE
.ReplaceString = HOLDDATA
End With
oDoc.ReplaceAll(S_Desc)
LINE_CT = LINE_CT + 1
J = J + 1
End Sub

_________________
OOo 3.4.5 on openSUSE 12.1
Use this forum : http://user.services.openoffice.org/en/forum
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    OOoForum.org Forum Index -> OpenOffice.org Writer All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group