Browse Source

Fix the cell content written for bool type

master
Debao Zhang 11 years ago
parent
commit
a042f5bc60
  1. 3
      examples/hello/main.cpp
  2. 2
      src/xlsxworksheet.cpp

3
examples/hello/main.cpp

@ -13,6 +13,9 @@ int main()
QXlsx::Workbook workbook;
QXlsx::Worksheet *sheet = workbook.addWorksheet();
sheet->write("A1", "Hello Qt!");
sheet->write("B3", 12345);
sheet->write("C5", "=44+33");
sheet->write("D7", true);
workbook.save(DATA_PATH"Test.xlsx");
workbook.save(DATA_PATH"Test.zip");
return 0;

2
src/xlsxworksheet.cpp

@ -413,7 +413,7 @@ void Worksheet::writeCellData(XmlStreamWriter &writer, int row, int col, const X
} else if (data.dataType == XlsxCellData::Boolean) {
writer.writeAttribute("t", "b");
writer.writeTextElement("v", data.value.toBool() ? "True" : "False");
writer.writeTextElement("v", data.value.toBool() ? "1" : "0");
} else if (data.dataType == XlsxCellData::Blank) {
//Ok, empty here.
}

Loading…
Cancel
Save