Hi Guys,
I am working on an existing Word doc that has two tables and i am filling the bottom table with data from a cursor, the problem is that the word doc, bottom table is predefined with 17 rows and if i have more than 17 records from the cursor, then the table2 on the Word doc, will get more than 17 rows causing the bottom text i have in the word doc, to get offset and jumping to a second page leaving the first page w/o that bottom text, besides a 2do page won't have the first table either, so i need if there are more than 17 records on the cursor, to make sure i will have one page with table1, table2 filled with the records from the cursor and the text at the bottom, then a second page with the same values on table1 as they t won't never change, then table2, should have the other values from the cursor and also the same text at the bottom, don't know how to control that.
can anyone has a suggestion please ?
Note: i will insert here the Original Word doc we use to save data on it, then the result of what happened with that Word doc(save as you can see below) when the data from the cursor has more than 17 records and course i will always has more than 17 records for the second table.
also i will include here a piece of code i borrowed from a friend.
Thanks in advance
I am working on an existing Word doc that has two tables and i am filling the bottom table with data from a cursor, the problem is that the word doc, bottom table is predefined with 17 rows and if i have more than 17 records from the cursor, then the table2 on the Word doc, will get more than 17 rows causing the bottom text i have in the word doc, to get offset and jumping to a second page leaving the first page w/o that bottom text, besides a 2do page won't have the first table either, so i need if there are more than 17 records on the cursor, to make sure i will have one page with table1, table2 filled with the records from the cursor and the text at the bottom, then a second page with the same values on table1 as they t won't never change, then table2, should have the other values from the cursor and also the same text at the bottom, don't know how to control that.
can anyone has a suggestion please ?
Note: i will insert here the Original Word doc we use to save data on it, then the result of what happened with that Word doc(save as you can see below) when the data from the cursor has more than 17 records and course i will always has more than 17 records for the second table.
also i will include here a piece of code i borrowed from a friend.
Thanks in advance
Code:
** Automation
LOCAL loW,loD, loT1, loT2,lnRow
LOCAL lcPath2
lcPath2 ="G:\APPROVED COMPANY FORMS\ISO DOCUMENTS\F-0830-005 Design Review Package.doc"
loW = CREATEOBJECT("Word.Application")
loD = m.loW.Documents.Add(m.lcPath2)
loT1 = m.loD.Tables[1]
loT2 = m.loD.Tables[2]
loT1.Cell[1,1].Range.InsertAfter(ALLTRIM(m.lccust_name))
loT1.Cell[1,2].Range.InsertAfter(ALLTRIM(m.lcjob_no))
loT1.Cell[2,1].Range.InsertAfter(ALLTRIM(m.lcmach_type))
lot1.Cell[2,2].range.paragraphs[1].range.Characters[lot1.Cell[2,2].range.paragraphs[1].range.Characters.count - 1].insertbefore(m.lc_TypM)
loT1.Cell[2,2].Range.InsertAfter(TRANSFORM(m.lc_date))
lnRow = 1
SELECT JUNK3 && cursor i am talking about
GO top
SCAN
IF m.lnRow = m.loT2.Rows.Count
m.loT2.Rows.Add()
ENDIF
lnRow = m.lnRow + 1
loT2.Cell[m.lnRow,1].Range.InsertAfter(ALLTRIM(Drawing))
loT2.Cell[m.lnRow,2].Range.InsertAfter(ALLTRIM(Sheet))
IF EMPTY(rev_d)
loT2.Cell[m.lnRow,3].Range.InsertAfter(TRANSFORM(SPACE(8)))
else
loT2.Cell[m.lnRow,3].Range.InsertAfter(TRANSFORM(rev_d))
ENDIF
loT2.Cell[m.lnRow,4].Range.InsertAfter(ALLTRIM(Description))
ENDSCAN
loW.Visible = .T.
loD.SaveAs(ADDBS(JUSTPATH(FULLPATH(m.lcPath2)))+"&lc_filen")