the-carlisle-group/APL2XL

Merge Cells

ndrogers opened this issue · 6 comments

The Merge Cells feature should be an optional property of a range.

This requires the same extension to cellXfs required by wrap text #14

An extension to cellXfs such as the following should be made to extend the xfs XML generation found in StyleXML.

  • Can multiple properties be added to alignment simultaneously?
  • What other types of properties exist for alignment?
alignment02 'alignment' ''('horizontal' 'center')
alignment12 'alignment' ''('wrapText' '1')
spreadalignment1{(,())[{,}]}c

An extension for rows is required. The value is placed into the first cell of the range that is to be merged. Other cell values are empty, but have the same type and style xfs index.

  <row r="1" spans="1:4" x14ac:dyDescent="0.35">
      <c r="A1" s="1" t="s">
        <v>0</v>
      </c>
      <c r="B1" s="1"/>
      <c r="C1" s="1"/>
      <c r="D1" s="1"/>
    </row>
    <row r="2" spans="1:4" x14ac:dyDescent="0.35">
      <c r="A2" s="1"/>
      <c r="B2" s="1"/>
      <c r="C2" s="1"/>
      <c r="D2" s="1"/>
    </row>
    <row r="3" spans="1:4" x14ac:dyDescent="0.35">
      <c r="A3" s="1"/>
      <c r="B3" s="1"/>
      <c r="C3" s="1"/>
      <c r="D3" s="1"/>
    </row>
.
.
.
  • How should you define a range that merges cells?
  • Should a Merge Cell range only contain a single value?
  • Should the Merge Cell property contain an APL shape to define the range?
  • etc.

MergeCells should be a boolean flag in the range object. All of the other properties in the range should be "scalar" or if an array is defined that matches the shape of the range, simply take the first item for the property and ignore the rest.

Not sure what you are planning for alignment, but should be just properties of the range like Value. HorizontalAlignment and VerticalAlignment.

@PaulMansour The point I was making about multiple alignment properties is that wrapText is a property for the <alignment/> tag within a xfs tag. So in that case, is it possible to have wrapText="1" and horizontal="center"? What other values are possible for horizontal, what other kinds of alignment are there aside from wrapText and horizontal. I'm just musing about this and need to learn more before solidifying the internal design.

So in that case, is it possible to have wrapText="1" and horizontal="center"?

Yes. Open excel and look at the Alignment tab on the Format Cells dialog box.

Commit 04f2c2c adds the following attributes to Ranges

range.MergeCells1  boolean scalar
range.Horizontal'center'  nested charvec, or nested char mat corresponding to the cells in range.Value
range.Vertical 'center' same as Horizontal
range.WrapText1  boolean scalar/vec/mat corresponding to the cells in range.Value
range.ShrinkToFie1  same as range.WrapText

Tests are yet to be added to validate these features.

Please test them at your leisure @PaulMansour @mkromberg

Tests.Utility.BasicWS is what I was using for testing, and I set the 2 ranges to different combinations of styles. I will now test these attributes more thoroughly and add test cases for them in the Tests directory.