I'm having trouble understanding how to get the formatted value of a date
cell. I'm using the PyUNO binding of the API, and trying to reformat a date
cell as YYYY-MM-DD. Here's (a somewhat slimmed down version of) the relevant
portion of the code, with various things I've tried in comments.
locale = document.getPropertyValue("CharLocale")
formats = document.getNumberFormats()
formatID = formats.queryKey("YYYY-MM-DD", locale, False)
line = []
for r in range(dataRange.StartRow, dataRange.EndRow):
for c in range(dataRange.StartColumn, dataRange.EndColumn):
cell = sheet.getCellByPosition(c,r)
cellType = cell.getType()
if cellType == UNO_VALUE and cell.NumberFormat == UNO_DATE:
cell.NumberFormat = formatID
line.append(cell.getText().String)
# line.append(cell.String)
# line.append(cell.getString())
# line.append(cell.Value)
# line.append(cell.getValue())
# line.append(cell.Formula)
All of the above give me floating point numbers instead of a date. I've also
tried displaying the value without changing the format. What am I missing?