mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
[GH-ISSUE #255] Corrupted EXCEL file #202
Labels
No labels
awaiting user feedback
bug
cmake
cmake
docs
feature request
in progress
long term
medium term
medium term
pull-request
question
question
ready to close
short term
under investigation
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/libxlsxwriter#202
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @hadrizi on GitHub (Dec 12, 2019).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/255
Originally assigned to: @jmcnamara on GitHub.
I am using libxlsxwriter to make DOS txt parser.
But when i tried to build an application for Windows it compiled with no errors, and when I opened my excel file I got this message
so most of my data was missed.
So i tried to write small example code and chek if problem appears again and it does.
I am using Visual Studio 2017, libxlsxwriter was built according to this guide, my OS is Windows 10
Here is small code i tried to compile:
P.S here is the code I compiled on Ubuntu 18.04. Sorry it is in Russian, but there is only one code file in src folder.
@jmcnamara commented on GitHub (Dec 12, 2019):
That source file doesn't have any issues:
I also ran the tArass file with the Readme.md file as input and that worked fine as well:
The issue is probably that you are processing a file that isn't UTF-8 encoded. All strings passed to libxlsxwriter (and Excel) must be UTF8 encoded. Do you think that may be your issue?
@hadrizi commented on GitHub (Dec 12, 2019):
@jmcnamara hm, this is strange I reloaded my PC and smaller code started to work. But tArass still doesn't work.


Here is file I'm parsing.
and it seems that file is UTF-8 encoded
@RaFaeL-NN commented on GitHub (Dec 12, 2019):
А строки ""Выполняемая команда" и т.п. в worksheet_merge_range ты точно в UTF-8 передаешь? Файл xlsx на выходе прикрепи, его можно распаковать и посмотреть, что там не нравится Excel
@hadrizi commented on GitHub (Dec 12, 2019):
Вот так я их передаю

а вот сам xlsx файл
@RaFaeL-NN commented on GitHub (Dec 12, 2019):
Строки ты передаешь в Win-1251, поэтому файл на выходе битый. Надо передавать в UTF-8. Я не знаю как это сделать в VS (не программист на С), возможно какой-то параметр сборки проекта. Либо использовать функции перекодирования MultiByteToWideChar/WideCharToMultiByte. Замени временно все русские строки на пустые либо транслитерируй их и увидишь, что дело в этом
@hadrizi commented on GitHub (Dec 13, 2019):
Да, так оно и есть. Я просто поменял кодировку исходника, собрал и все сработало.
@jmcnamara commented on GitHub (Dec 13, 2019):
@RaFaeL-NN Спасибо за помощь