|
@@ -258,7 +258,7 @@ func (l *LibSuite) TestGetStyleWithFonts(c *C) {
|
|
|
|
|
|
|
|
xStyles = &xlsxStyles{Fonts: fonts, CellXfs: cellXfs}
|
|
xStyles = &xlsxStyles{Fonts: fonts, CellXfs: cellXfs}
|
|
|
|
|
|
|
|
- cell = &Cell{Value: "123", styleIndex: 1, styles: xStyles}
|
|
|
|
|
|
|
+ cell = &Cell{Value: "123", styleIndex: 0, styles: xStyles}
|
|
|
style = cell.GetStyle()
|
|
style = cell.GetStyle()
|
|
|
c.Assert(style, NotNil)
|
|
c.Assert(style, NotNil)
|
|
|
c.Assert(style.Font.Size, Equals, 10)
|
|
c.Assert(style.Font.Size, Equals, 10)
|
|
@@ -284,7 +284,7 @@ func (l *LibSuite) TestGetStyleWithFills(c *C) {
|
|
|
|
|
|
|
|
xStyles = &xlsxStyles{Fills: fills, CellXfs: cellXfs}
|
|
xStyles = &xlsxStyles{Fills: fills, CellXfs: cellXfs}
|
|
|
|
|
|
|
|
- cell = &Cell{Value: "123", styleIndex: 1, styles: xStyles}
|
|
|
|
|
|
|
+ cell = &Cell{Value: "123", styleIndex: 0, styles: xStyles}
|
|
|
style = cell.GetStyle()
|
|
style = cell.GetStyle()
|
|
|
fill := style.Fill
|
|
fill := style.Fill
|
|
|
c.Assert(fill.PatternType, Equals, "solid")
|
|
c.Assert(fill.PatternType, Equals, "solid")
|
|
@@ -312,7 +312,7 @@ func (l *LibSuite) TestGetStyleWithBorders(c *C) {
|
|
|
|
|
|
|
|
xStyles = &xlsxStyles{Borders: borders, CellXfs: cellXfs}
|
|
xStyles = &xlsxStyles{Borders: borders, CellXfs: cellXfs}
|
|
|
|
|
|
|
|
- cell = &Cell{Value: "123", styleIndex: 1, styles: xStyles}
|
|
|
|
|
|
|
+ cell = &Cell{Value: "123", styleIndex: 0, styles: xStyles}
|
|
|
style = cell.GetStyle()
|
|
style = cell.GetStyle()
|
|
|
border := style.Border
|
|
border := style.Border
|
|
|
c.Assert(border.Left, Equals, "thin")
|
|
c.Assert(border.Left, Equals, "thin")
|
|
@@ -444,6 +444,32 @@ func (l *LibSuite) TestReadWorkbookRelationsFromZipFileWithFunnyNames(c *C) {
|
|
|
c.Assert(cell1.String(), Equals, "I am Bob")
|
|
c.Assert(cell1.String(), Equals, "I am Bob")
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+func (l *LibSuite) TestGetStyleFromZipFile(c *C) {
|
|
|
|
|
+ var xlsxFile *File
|
|
|
|
|
+ var err error
|
|
|
|
|
+
|
|
|
|
|
+ xlsxFile, err = OpenFile("testfile.xlsx")
|
|
|
|
|
+ c.Assert(err, IsNil)
|
|
|
|
|
+ sheetCount := len(xlsxFile.Sheet)
|
|
|
|
|
+ c.Assert(sheetCount, Equals, 3)
|
|
|
|
|
+
|
|
|
|
|
+ tabelle1 := xlsxFile.Sheet["Tabelle1"]
|
|
|
|
|
+
|
|
|
|
|
+ row0 := tabelle1.Rows[0]
|
|
|
|
|
+ cellFoo := row0.Cells[0]
|
|
|
|
|
+ c.Assert(cellFoo.String(), Equals, "Foo")
|
|
|
|
|
+ c.Assert(cellFoo.GetStyle().Fill.BgColor, Equals, "FF33CCCC")
|
|
|
|
|
+
|
|
|
|
|
+ row1 := tabelle1.Rows[1]
|
|
|
|
|
+ cellQuuk := row1.Cells[1]
|
|
|
|
|
+ c.Assert(cellQuuk.String(), Equals, "Quuk")
|
|
|
|
|
+ c.Assert(cellQuuk.GetStyle().Border.Left, Equals, "thin")
|
|
|
|
|
+
|
|
|
|
|
+ cellBar := row0.Cells[1]
|
|
|
|
|
+ c.Assert(cellBar.String(), Equals, "Bar")
|
|
|
|
|
+ c.Assert(cellBar.GetStyle().Fill.BgColor, Equals, "")
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
func (l *LibSuite) TestLettersToNumeric(c *C) {
|
|
func (l *LibSuite) TestLettersToNumeric(c *C) {
|
|
|
cases := map[string]int{"A": 0, "G": 6, "z": 25, "AA": 26, "Az": 51,
|
|
cases := map[string]int{"A": 0, "G": 6, "z": 25, "AA": 26, "Az": 51,
|
|
|
"BA": 52, "Bz": 77, "ZA": 26*26 + 0, "ZZ": 26*26 + 25,
|
|
"BA": 52, "Bz": 77, "ZA": 26*26 + 0, "ZZ": 26*26 + 25,
|