open excel files with umlauts on win works now
This commit is contained in:
parent
27edf6b6ea
commit
a04e8ad837
2 changed files with 10 additions and 4 deletions
|
@ -1,16 +1,22 @@
|
|||
#include "excelreader.h"
|
||||
|
||||
#include <xlnt/xlnt.hpp>
|
||||
#include <fstream>
|
||||
|
||||
void ExcelReader::readSellersFromFile(const std::filesystem::path& filePath, Marketplace* market)
|
||||
{
|
||||
xlnt::workbook wb;
|
||||
std::ifstream mystream(filePath, std::ios::binary);
|
||||
if(!mystream.is_open()) {
|
||||
throw std::runtime_error("Could not open ecxel file");
|
||||
}
|
||||
wb.load(mystream);
|
||||
|
||||
for (auto& seller : market->getSellers()) {
|
||||
seller->setState(Seller::State::DELETE);
|
||||
}
|
||||
market->storeToDb(true);
|
||||
|
||||
xlnt::workbook wb;
|
||||
wb.load(filePath);
|
||||
market->storeToDb(true);
|
||||
auto ws = wb.sheet_by_index(0);
|
||||
|
||||
const int START_ROW = 5;
|
||||
|
|
|
@ -378,7 +378,7 @@ void MainWindow::onImportSellerExcelActionTriggered()
|
|||
if (filename.isEmpty())
|
||||
return;
|
||||
|
||||
std::filesystem::path filePath(filename.toStdU16String());
|
||||
std::filesystem::path filePath(filename.toStdWString());
|
||||
|
||||
ExcelReader::readSellersFromFile(filePath, marketplace_.get());
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue