Can not merge 2 header columns with set_MergeCol

Posted by: van-thien on 15 January 2024, 7:14 pm EST

  • Posted 15 January 2024, 7:15 pm EST

    I migrate a Windows app from VB6 to VBNET.

    I use C1.Win.C1FlexGrid.Classic to design grid.

    But I can not merge 2 header columns with the set_MergeCol function

    With flexrKTList
    
                .Clear(ClearWhereSettings.flexClearEverywhere, ClearWhatSettings.flexClearEverything)
                .Cols = 16
                .Rows = 2
    
                .MergeCells = MergeSettings.flexMergeFixedOnly
                .set_MergeCol(0, True)
                .set_MergeCol(1, True)
                .set_MergeRow(0, True)
    
                .set_TextMatrix(0, 0, "開始工程")
                .set_TextMatrix(1, 0, "開始工程")
                For intCnt = 1 To 7
                    .set_TextMatrix(0, intCnt * 2 - 1, Format(DateAdd(Microsoft.VisualBasic.DateInterval.Day, -1 * (7 - intCnt), mdteBaseDay), "M/d(ddd)"))
                    .set_TextMatrix(0, intCnt * 2, .get_TextMatrix(0, intCnt * 2 - 1))
                    .set_TextMatrix(1, intCnt * 2 - 1, "件数")
                    .set_TextMatrix(1, intCnt * 2, "数量")
                    .set_ColWidth(intCnt * 2 - 1, TwipsToPixels(700))
                    .set_ColWidth(intCnt * 2, TwipsToPixels(900))
                Next intCnt
    
                ''.let_Cell(VSFlex7L.CellPropertySettings.flexcpBackColor, 0, 13, 1, 15, &HFFC0C0)
    
                .set_ColWidth(0, TwipsToPixels(3200))
                .set_ColWidth(15, TwipsToPixels(0))
    
                .set_FixedAlignment(-1, AlignmentSettings.flexAlignCenterCenter)
                .set_ColAlignment(-1, AlignmentSettings.flexAlignRightCenter)
                .set_ColAlignment(0, AlignmentSettings.flexAlignLeftCenter)
    
                .set_RowHeight(-1, TwipsToPixels(400))
            End With
  • Posted 17 January 2024, 11:35 pm EST

    Hello,

    Apologies for the delayed response.

    C1FlexGridClassic is a wrapper class for C1FlexGrid, designed to facilitate a seamless transition from VSFlexGrid to C1FlexGrid.

    You can merge Fixed Columns in C1FlexGridClassic by setting the MergeCells property to MergeSettings.flexMergeFixedOnly and setting the AllowMerge property of each Column to True as follows:

    C1FlexGridClassic1.MergeCells = C1.Win.C1FlexGrid.Classic.MergeSettings.flexMergeFixedOnly
    
    For Each col As C1.Win.C1FlexGrid.Column In C1FlexGridClassic1.ColumnCollection
        col.AllowMerging = True
    Next

    Please refer to the attached sample for implementation. (see FlexGridClassic48_MergeHeaders_VB.zip)

    Regards,

    Uttkarsh.

Need extra support?

Upgrade your support plan and get personal unlimited phone support with our customer engagement team

Learn More

Forum Channels