Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Visual Documents 2.0 categories in report crashs program
Message
From
31/12/2002 00:11:16
Michael Gass
Instructional Software, Inc.
Kirkland, Washington, United States
 
 
To
30/12/2002 04:48:50
General information
Forum:
Visual FoxPro
Category:
CodeMine
Miscellaneous
Thread ID:
00736473
Message ID:
00736858
Views:
16
>>My guess is that it has something to do with the way I set up the template in MS Word which was >saved as an RTF file then called from a memo field.
>
>1. What approach did you use to get the Word RTF file into the memo field? (please be specific)

I save the template using MS Word in an RTF file then open the file using Windows Notepad. I copy the content from the Notepad and paste it into a memo field.

>2. How are you loading the RTF template from within your program? (ie., LoadTemplate/LoadTemplateFile)

I'm loading the template into the datastream from the memo field using the following command:

m.nstream = m.ortf.loadtemplate(REPTTMPL.Template)

I'm using the following command to copy the category group and insert the category title:

IF ! EMPTY(m.cLastCategory) AND (! m.cLastCategory == category)
m.ortf.CopyGroup(m.nStream, 'Category', 'Item')
ENDIF

IF NOT m.cLastCategory == category
m.cLastCategory = category
m.ortf.InsertText(m.nStream, 'Category', TRIM(category))
ENDIF

I'm using the following to copy and insert the details:

SCAN
IF ortf.IsDirty(m.nStream, 'Item')
ortf.CopyGroup(m.nStream, 'Item')
ENDIF
temp = ' ' + ALLTRIM(empl_per.fullname)
m.ortf.InsertText(m.nstream, 'Item', temp)
ENDSCAN

I was having difficulties filling in multiple items in a group when I used code like this:

ortf.CopyGroup(m.nStream, 'START', 'END')

The results displayed with all the records in field1 showing in the first item and all the records in field2 showing in the second item, etc. rather than the record1, field1, field2, etc., then record2, field1, field2, etc. I changed the template so there were no hard paragraph breaks in a group and the entire group was just one paragraph. Then I could use CopyGroup with just one reference to the group, e.g. 'Item' as opposed to 'START' and 'END' and the data displayed correctly. I have no idea why this worked and the other didn't.

I then use the following to save the data stream to an RTF file and open TXText Control which automatically opens the RTF file.

m.ortf.generatefile(m.nstream, 'output.RTF')
RUN /N1 CMS_WP.EXE

I appreciate your time and your help. Thanks!
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform