ReoGrid Forum

Fast and powerful .NET Spreadsheet Component

You are not logged in.

Announcement

This forum has been archived and no longer accepts new user registrations. Please report your questions, problems, and feedback to the issue page of ReoGrid on GitHub. Thank you for your cooperation.

https://github.com/unvell/ReoGrid/issues

#1 2014-12-13 03:58:40

asparatu
Member
Registered: 2014-08-20
Posts: 196

Merge Cells and SetRangeStyle

I have interesting issue, I have on cell that is merged and i use SetRangeStyle on it, but when i was using v0.8.6.2, I was able to use on SetRangeStyle, but when i took and starting using v0.8.8, I have to use two different SetRangeStyles.

only code for v0.8.6.2

.SetRangeStyle(New ReoGridRange(0, 0, 2, 3),
                     New ReoGridStyleObject With {.Flag = PlainStyleFlag.BackColor Or PlainStyleFlag.TextColor,
                                                  .BackColor = ColorTranslator.FromWin32(RGB(78, 78, 78)),
                                                  .TextColor = ColorTranslator.FromWin32(RGB(166, 166, 166))})

and it looks like this:

2c9b3e2a7ae3b9c53d766a0ad310d7ee.jpg

If use the same code it looks like this in v0.8.8

3a2e3c69a5006f168daddfe44fe4a09b.jpg

I got to work in version 0.8.8 by using this code:

 .SetRangeStyle(New ReoGridRange(0, 0, 2, 3),
                     New ReoGridStyleObject With {.Flag = PlainStyleFlag.BackColor Or PlainStyleFlag.TextColor,
                                                  .BackColor = ColorTranslator.FromWin32(RGB(78, 78, 78)),
                                                  .TextColor = ColorTranslator.FromWin32(RGB(166, 166, 166))})

.SetRangeStyle(New ReoGridRange(0, 0, 2, 1),
                      New ReoGridStyleObject() With {.Flag = PlainStyleFlag.BackColor Or PlainStyleFlag.TextColor _
                                                                    Or PlainStyleFlag.FontSize,
                                                                    .BackColor = ColorTranslator.FromWin32(RGB(78, 78, 78)),
                                                                    .FontSize = 9,
                                                                    .TextColor = ColorTranslator.FromWin32(RGB(166, 166, 166))})

As you can see I used the first code and add same thing but only for the merged cells, but if change the range to ReoGridRange(0,0,2,2), it will take and do the merged cells and second cell, when setting all three column and it only does 2nd and 3rd cell and not 1st.

Shane

Last edited by asparatu (2014-12-13 04:22:17)

Offline

#2 2014-12-13 04:32:04

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Merge Cells and SetRangeStyle

Hi Shane,

I think it's a bug, the cell lost font style information. Did you set any styles for entire grid? or entire column/row before set the (0,0) cell.
The style management code has been rewritten in 0.8.8 for memory-use improvement, it is a little different compare the old 0.8.7 version. Let me fix this before release 0.8.8.1.

Jing

Offline

#3 2014-12-13 05:15:23

asparatu
Member
Registered: 2014-08-20
Posts: 196

Re: Merge Cells and SetRangeStyle

Jing,
   I did set range styles before i set that.. here is the full code

 Private Sub CreateDataGathingGrid()
        Dim count As Integer = 1

        'WorkBook Settings
        With rgDataGatheringControlContainer
            .SetSettings(WorkbookSettings.View_ShowScrolls _
                              Or WorkbookSettings.View_ShowSheetTabControl, False)
        End With

        'WorkSeet Settings
        With rgDataGatheringControl
            .MergeRange(0, 0, 2, 1)

            .ColumnHeaders(0).WidthInPixel = 80
            .ColumnHeaders(1).WidthInPixel = 120
            .ColumnHeaders(2).WidthInPixel = 120

            .SetSettings(unvell.ReoGrid.WorksheetSettings.View_ShowRowHeader _
                             Or unvell.ReoGrid.WorksheetSettings.View_ShowColumnHeader, False)

            .SetRangeBorder(New ReoGridRange(0, 0, 32, 3), ReoGridBorderPos.All, _
                            New ReoGridBorderStyle() With {.Color = ColorTranslator.FromWin32(RGB(89, 89, 89)),
                                                           .Style = BorderLineStyle.Solid})

            .SetRangeStyle(New ReoGridRange(0, 0, 32, 1),
                           New ReoGridStyleObject With {.Flag = PlainStyleFlag.BackColor Or PlainStyleFlag.TextColor,
                                                        .BackColor = ColorTranslator.FromWin32(RGB(78, 78, 78)),
                                                        .TextColor = ColorTranslator.FromWin32(RGB(166, 166, 166))})

            .SetRangeStyle(New ReoGridRange(2, 1, 32, 2),
                          New ReoGridStyleObject With {.Flag = PlainStyleFlag.BackColor Or PlainStyleFlag.TextColor,
                                                       .BackColor = Color.Black,
                                                       .TextColor = Color.White})


            .SetRangeStyle(New ReoGridRange(0, 0, 2, 3),
                     New ReoGridStyleObject With {.Flag = PlainStyleFlag.BackColor Or PlainStyleFlag.TextColor,
                                                  .BackColor = ColorTranslator.FromWin32(RGB(78, 78, 78)),
                                                  .TextColor = ColorTranslator.FromWin32(RGB(166, 166, 166))})


            .SetRangeStyle(New ReoGridRange(0, 0, 2, 1),
                           New ReoGridStyleObject() With {.Flag = PlainStyleFlag.BackColor Or PlainStyleFlag.TextColor _
                                                                      Or PlainStyleFlag.FontSize,
                                                                      .BackColor = ColorTranslator.FromWin32(RGB(78, 78, 78)),
                                                                      .FontSize = 9,
                                                                      .TextColor = ColorTranslator.FromWin32(RGB(166, 166, 166))})

            'Sets the alignment for the grid
            .SetRangeStyle(New ReoGridRange(0, 0, 32, 3),
                                   New ReoGridStyleObject() With {.Flag = PlainStyleFlag.AlignAll,
                                                                               .VAlign = ReoGridVerAlign.Middle,
                                                                               .HAlign = ReoGridHorAlign.Center
                                                                                })
            Dim range As New ReoGridRange(2, 1, 32, 2)

            AddHandler .BeforeCellEdit, 
                             Sub(s, eventArgs) eventArgs.IsCancelled = Not range.Contains(eventArgs.Cell.Position())

            .FocusPos = range.StartPos

            .SetCellData("A1", "Reference")
            .SetCellData("B1", "Input Variable (X)")
            .SetCellData("C1", "Output Variable (Y)")

            .FreezeToCell(2, 2, FreezePosition.Top)

            'Add the numbers to the grid
            For i As Integer = 2 To .RowCount - 1
                .SetCellData(i, 0, count)
                .Cells(i, 0).IsReadOnly = True
                count += 1
            Next

            'Sets the readonly for the header cells
            For j As Integer = 0 To 1
                For k As Integer = 0 To 2
                    .Cells(j, k).IsReadOnly = True
                Next
            Next
        End With

        'WorkBook Settings
        With rgDataGatheringControlContainer
            .CanUndo()
            .CanRedo()
        End With

        'Enables the has been setup for the grid
        m_blnHasBeenSetup = True
    End Sub

Shane

Last edited by asparatu (2014-12-13 05:17:04)

Offline

#4 2014-12-13 05:24:11

Jingwood
Moderator
From: jing at reogrid.net
Registered: 2014-06-03
Posts: 615

Re: Merge Cells and SetRangeStyle

Thanks for the code, I also found some problems there, now I'm trying to fix it and release the 0.8.8.1 within 8 hours.

Offline

#5 2014-12-13 05:33:50

asparatu
Member
Registered: 2014-08-20
Posts: 196

Re: Merge Cells and SetRangeStyle

ok..

Offline

#6 2014-12-16 01:26:24

asparatu
Member
Registered: 2014-08-20
Posts: 196

Re: Merge Cells and SetRangeStyle

Jing,
   I have removed the code for the merged cells only and it work like did before.. Thank you. If have any other issue i will inform you.

Shane

Offline

Board footer

Powered by FluxBB