I made a normal cscVpeReport with one break level that works fine. However, some details must sometimes be adjusted in that report, anmd it cannot be done in the database. My idea was to print the report lines to an Excel file, make the changes there, read the Excel file to a CJGrid and print with a slightly modifies VPE4VDF report. That works except for subheaders. When data are in the database, the subheader data correspond to the first record in the next section, as it should be. It is a headline for the lines below.

However, if data is in a cjGrid, the subheader headline corresponds to data in the previous section, which is wrong. What can be done to change that?


Code:
        SZBREAK_BEGIN      // This works
            If (Checked_State(oCheckBoxGruppRubrik(Self))) SZBREAK ART.GRUPP
        SZBREAK_END

        Object oSubHeader1 is a cSzReportSection
            Set psSectionname to "Subheader1"
            Set piSectionHeight to 80
            Set piSectionType to SZSUBHEADER
            Set piBreakLevel to 1
            Set pbOverrideFormatting to True

            Procedure DoOutputSection
                    Send DoVpeSetTextColor clGreen
//                    Send szWriteLnPos NGFGRUPP.BET VLEFTMARGIN VPE_ALIGN_LEFT
                    Send szWriteLnPos vaxt.latin VLEFTMARGIN VPE_ALIGN_LEFT
                    Send DoVpeSetTextColor clBlack
                    Send DoVpeRefreshDoc
            End_Procedure
            //        SZEND_SECTION
        End_Object

This code print wrong subheaders


Code:
SZBREAK_BEGIN
        tDataSourceRow[] dsa
        Get pDataSourceArray to dsa
        If (Checked_State(oCheckBoxGruppRubrik(Self))) SZBREAK dsa[CurrentDataSourceIndex(Self)].sValue[2]
        SZBREAK_END

        Object oSubHeader1 is a cSzReportSection
            Set psSectionname to "Subheader1"
            Set piSectionHeight to 80
            Set piSectionType to SZSUBHEADER
            Set piBreakLevel to 1
            Set pbOverrideFormatting to True

            Procedure DoOutputSection
                Boolean bGrupprub
                String sKod
                tDataSourceRow[] dsa
                    Get pDataSourceArray to dsa
                    Move dsa[CurrentDataSourceIndex(Self)].sValue[2] to sKod
                    Clear NGFGRUPP
                    Move sKod to NGFGRUPP.VARUGRUPP
                    Find EQ NGFGRUPP by Index.1
                    Send DoVpeSetTextColor clGreen
//                    Send szWriteLnPos NGFGRUPP.BET VLEFTMARGIN VPE_ALIGN_LEFT
                    Send szWriteLnPos dsa[CurrentDataSourceIndex(Self)].sValue[6] VLEFTMARGIN VPE_ALIGN_LEFT
                    Send DoVpeSetTextColor clBlack
                    Send DoVpeRefreshDoc
            End_Procedure
            //        SZEND_SECTION
        End_Object