[TD]correct s/s cell format

This commit is contained in:
wandererfan
2024-03-04 10:02:14 -05:00
parent d60e7b9eae
commit 4d7f9f00f4

View File

@@ -31,6 +31,8 @@
#include <App/Property.h>
#include <Base/Console.h>
#include <Base/Tools.h>
#include <Mod/Spreadsheet/App/Cell.h>
#include <Mod/Spreadsheet/App/Sheet.h>
@@ -268,12 +270,13 @@ std::string DrawViewSpreadsheet::getSheetImage()
App::Property* prop = sheet->getPropertyByName(address.toString().c_str());
std::stringstream field;
if (prop && cell) {
if (
prop->isDerivedFrom(App::PropertyQuantity::getClassTypeId()) ||
prop->isDerivedFrom(App::PropertyFloat::getClassTypeId()) ||
prop->isDerivedFrom(App::PropertyInteger::getClassTypeId())
) {
std::string temp = cell->getFormattedQuantity(); //writable
if (prop->isDerivedFrom(App::PropertyQuantity::getClassTypeId())) {
auto contentAsQuantity = static_cast<App::PropertyQuantity*>(prop)->getQuantityValue();
auto ustring = contentAsQuantity.getUserString();
field << Base::Tools::toStdString(ustring);
} else if (prop->isDerivedFrom(App::PropertyFloat::getClassTypeId()) ||
prop->isDerivedFrom(App::PropertyInteger::getClassTypeId())) {
std::string temp = cell->getFormattedQuantity();
DrawUtil::encodeXmlSpecialChars(temp);
field << temp;
} else if (prop->isDerivedFrom(App::PropertyString::getClassTypeId())) {