Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Report to word
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Report to word
Divers
Thread ID:
00614342
Message ID:
00614342
Vues:
54
Hi All,

I'm trying to send a report to "Word" using Tamar Granor's book as a guideline.

How do I, using the tables scenario,

1. create a page header
2. add columns headings on each page

Here is what I've accomplished so far.

I understand there's a .insertbreak property but can't seem to find the right syntax to get the column headings in the table row.

The header code seems to add the header but then it disappears before the report is finished.

Any guidance would be appreciated.

***hsfrmmaresbooked.m_towordwithtable()
***************************************************
*
*
*
* there will be about 14 columns when finished, I'm only
* working with two right now.
*
*
* I will also probably want to create groups on the booked_to
* field and do subtotals at a later date.
*
**************************************************
#define wdstory 6
#define wdcollapseend 0
#define cr chr(13)
#define wdbordertop -1
#define wdlinestyledouble 7
#define wdalignparagraphleft 0
#define wdalignparagraphcenter 1
#define wdalignparagraphright 2
#define wdheaderfooterprimary 1
release all like o*
public oword
local orange, otable, nreccount, ntotalorders
local nrow
oword = createobject("word.application")
oword.documents.add()
oword.visible = .t.
nreccount = _tally
orange = oword.activedocument.range()
#define autoinchestopoints 50
with oword.selection.pagesetup
.orientation = 1
.topmargin = 1.00 * autoinchestopoints
.bottommargin = 1.00 * autoinchestopoints
.leftmargin = 1.00 * autoinchestopoints
.rightmargin = 1.00 * autoinchestopoints
endwith
orange.font.name = 'ariel'
orange.font.size = 7
orange.moveend(wdstory)
orange.collapse(wdcollapseend)
orange.insertafter(cr + cr)
orange.collapse(wdcollapseend)
***********************************************
***section to add header to each page ?????
*!* with oword.documents.sections[1].headers[ wdHeaderFooterPrimary ]
*!* trange = .range()
*!* with trange
*!* .text = "Hanover Shoe Farms, Inc." + cr + "Mares Booked"
*!* .paragraphformat.alignment = wdalignparagraphcenter
*!* with .font
*!* .name = "ariel"
*!* .size = 10
*!* .bold = .t.
*!* endwith
*!* endwith
*!* endwith
***********************************************
otable = oword.activedocument.tables.add(orange,2,4)
with otable
.borders.insidelinestyle = .f.
.borders.outsidelinestyle = .f.
*************************************************************************
*
*
* I would like the column headers to appear in the top row of each new page????
*
*
***********************************************************************
.cell[1,1].range.paragraphformat.alignment = wdalignparagraphleft
.cell[1,1].range.insertafter("Booked To")
.cell[1,2].range.paragraphformat.alignment = wdalignparagraphleft
.cell[1,2].range.insertafter("Mare")
.cell[2,1].range.paragraphformat.alignment = wdalignparagraphleft
.cell[2,2].range.paragraphformat.alignment = wdalignparagraphleft
for nrow = 1 to nreccount
with .rows[nRow + 1]
.cells[1].range.insertafter(booked_to)
.cells[2].range.insertafter(name)
endwith
.rows.add()
skip
endfor
.columns.autofit
endwith
**********************
*
*
* END
*
*
*********************
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform