It's time we looked in the demo grid demo and try and explain what is happening, perhaps I can shed some light that I also found yesterday, which was infront of me all this time... If you have trouble please refer to the Excel Sheet above.
' create the page grid
page.AddRows(1,True, "").AddCells12(1,"")
page.AddRowsM(1,True,0,0, "").AddCellsOS(12,0,0,0,1,1,1,"")
page.AddRows(3,True, "").AddCells12(1,"")
page.AddRowsM(1,True,0,0, "").AddCellsOS(2,0,0,0,6,6,6,"")
page.AddRows(2,True, "").AddCells12(1,"")
page.AddRowsM(1,True,0,0, "").AddCellsOS(1,6,6,6,6,6,6,"")
page.AddRows(6,True, "").AddCells12(1,"")
Above is the grid example and it has been explained in the demo, let me try and also explain it in terms of how I see it.
Remember: Offset - gap between columns, MarginTop - top margin of the cell, MarginBottom - bottom margin of the cell, Size - number of spaces to span.
Let go each line bit by bit.
page.AddRows(1,True, "").AddCells12(1,"")
Add 1 row with a 1 column that spans 12 spaces of equal length in all devices. The row should be centered on the page i.e. True
I will also try and explain this using Excel. In the row, 1 column spaning 12 spaces is created, so all spaces will be taken, think of it as "merged".
page.AddRowsM(1,True,0,0, "").AddCellsOS(12,0,0,0,1,1,1,"")
Here we need to specify the margins per device
.
The columns in this stance are not merged, each column stands by itself.
As you might have noted, the definitions always start with small, then medium, then large for all properties whether offset, size, margin, padding.
Here we are adding a single row, that is centered on the page with 0 top and bottom margins. In the row we add 12 columns (AddCellsOS(12, we dont want any 'gaps' between the columns, this 0,0,0 for offsets for small, medium and large devices and each column should span 1 space each, 1,1,1, no theme should be applied. As indicated here, we have to specify OS (Offsets and Sizes / Span)
page.AddRows(3,True, "").AddCells12(1,"")
This one adds 3 rows that are centered on the page, the top margin is 0px with a bottom margin of 20px
, then in the row add 1 column that spans 12 spaces each for all devices. With excel..., 3 rows per device taking with a 12 area span.
page.AddRowsM(1,True,0,0, "").AddCellsOS(2,0,0,0,6,6,6,"")
Add a single row with 0 top margin and 0 bottom margin. Add 2 columns (AddCellsOS(2, there should be no gaps between the columns, each column should span 6 spaces across all devices.
I will use Excel to demonstrate this, thanks to Alian for his inbox.. All the
Two columns, each with a span of 6 spaces each.
page.AddRows(2,True, "").AddCells12(1,"") : I will skip this, I think you understand now.
page.AddRowsM(1,True,0,0, "").AddCellsOS(1,6,6,6,6,6,6,"")
Add a single row, centered on the page with 0 top margin and 0 bottom margin
, within the row, add a single column (AddCellsOS(1, here we need to specify the Offsets and Sizes (Spans) for each column. Each column should have 6 gaps and should span 6 spaces per device.
With this one, the second part of the column is used as the other part was offset 6 spaces each per device. That covers it.