Welcome to OpenXML Developer Sign in | Join | Help

Fill Index 0

Last post 09-12-2008, 2:49 AM by zeljc. 8 replies.
Sort Posts: Previous Next
  •  07-11-2007, 2:51 PM 1754

    Fill Index 0

    I was wondering if anyone else noticed this or am I doing something wrong.  I created a file with a single yellow filled cell.  Then I went into the file and edited the 0-index fill to be a colour rather than the default "none", thus I have the resulting set of fills in styles.xml

      <fills count="3">
        <fill>
          <patternFill patternType="solid">
            <fgColor rgb="FFFF0000" />
            <bgColor indexed="64" />
          </patternFill>
        </fill>
        <fill>
          <patternFill patternType="gray125" />
        </fill>
        <fill>
          <patternFill patternType="solid">
            <fgColor rgb="FFFFFF00" />
            <bgColor indexed="64" />
          </patternFill>
        </fill>
      </fills>

    I then take the original XF which refers to the yellow fill

       <xf numFmtId="0" fontId="0" fillId="2" borderId="0" xfId="0" applyFill="1" />

    And change it such that it refers to the 0 indexed fill

       <xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0" applyFill="1" />

    However, instead of seeing red, I see no fill in Excel.  Does this mean that if we see fillId=0 we shouldn't look it up, but rather assume that it is a hardcoded "none"?

    Thanks!

  •  07-13-2007, 12:26 AM 1763 in reply to 1754

    Re: Fill Index 0

    Hi,

     

    I think, when the fillId is set to 0, then it always takes built in style irrespective of whatever has set 0th index. And the same is true for borderId also.

     

  •  07-16-2007, 3:51 AM 1776 in reply to 1763

    Re: Fill Index 0

    Fill ID zero ALWAYS has to be a pattern fill (gray125). Custom fills start at index 1 and up.

    Regards,
    Maarten
  •  07-16-2007, 9:10 AM 1780 in reply to 1776

    Re: Fill Index 0

    Actually, fill ID 0 is always none.  Fill ID 1 is gray125.  I actually never thought to check if fill ID 1 is also hardcoded, and also ignores what is stored in the file.  Thanks for pointing that out to me.

    Andrea

  •  07-27-2007, 12:24 AM 1819 in reply to 1780

    Re: Fill Index 0

    i think thar fill 0 and fill 1 are both predefined,fill 0 for none, fill 1 is the color of

    row and column number cell , such as "A" , "1".

  •  09-11-2008, 9:03 AM 3679 in reply to 1819

    Re: Fill Index 0

    hi all

    i've read your posts and i have a similar problem but with formatting the columns. i have all the appropriate parameters
    "numFmt numFmtId="100" formatCode="mm.dd.yyyy;@"/"
    and it shows inside the excel in the "format cells/custom" but it is not applayed to the column.
    lower in the styles.xml is also this line(as it should be)
    ""xf numFmtId="100" fontId="0" fillId="2" borderId="0" xfId="0" applyNumberFormat="1"/"". also in the sheet I set the s parameter to s="3"(it is on the forth line of cellXfs). what am i doing wrong?
  •  09-11-2008, 10:28 AM 3680 in reply to 3679

    Re: Fill Index 0

    The numFmt and the xf look fine to me.  I tried creating a column default in Excel, and I got the style applied to the column as such, as well as the style stored in each cell

    <cols>

     <col min="7" max="7" width="9.140625" style="1" />

    </cols>

    Now, I assume it would make sense that if there was a column default that each cell wouldn't need to duplicate the information, however that was not the case, I had to store an "s" attribute for every cell, if I removed them, even with the style applied to the column, the number formatting was gone.  I then removed the style="1" from the column, and it had no effect (of course not, what with each cell storing the style itself).

    Does this mean that the concept of column defaults don't actually work?  Or maybe that the style of the column only applies to undefined cells, while if a cell has been defined it must store its own style index?

    Hopefully something in what I wrote here will help.  I'm not really sure what is wrong in your file because based on what you wrote, it looks like it should be fine.  Does the fill (fillId="2") part of the xf work?

    Oh, and ignore the cellStyleXF's, if I recall correctly they don't work at all (there is another thread in the forum about that).  Use only the cellXF's.

     

  •  09-12-2008, 2:32 AM 3683 in reply to 3680

    Re: Fill Index 0

    thanks for the reply

    the fill fills all other cells but those that have data in them. i set the whole column for the fill and it fills it. except from C2 to C6(that's where the data is).
    i also set the s attribute for each cell(forgot to write yesterday) and it didn't do anything.

    i have also tried(first i created it by code, saved the excel file and then add the formatting inside excel file) setting it in the excel file and then look for it in zip package, just to see what it wrote:
    "xf numFmtId="4" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1" /"

    can't find where is numFmtId="4, because there is only one numFmtId in the numFmts, which i set. also i have found the numFmtId = "49" - no idea where it is.
  •  09-12-2008, 2:49 AM 3685 in reply to 3683

    Re: Fill Index 0

    ok the fill works fine. i only set the style for the cell that contains the data not the whole column. the fill is on the third place of the fills node in my case. i will also try setting the formating only on the cell that contains the data.

    i have seen you have bgColor index the same in two nodes. try another number. I have set it to 65 and it works
View as RSS news feed in XML