当前位置:网站首页>Openxlsx field reading problem
Openxlsx field reading problem
2022-07-05 07:35:00 【sukhoi27smk】
In the reading excel I found that some fields cannot be read , Through the excel After decompressing the file, we found , Normal read and no
The fields that can be read normally are sharedString.xml The format stored in is different , Take one of the fields , Here's the picture :
Normally read

Unreadable


The difference can be seen by comparison , Then look for openxlsx Treatment of this piece , Find the following code by debugging the code :
const char* XLSharedStrings::getString(uint32_t index) const
{
auto iter = xmlDocument().document_element().children().begin();
std::advance(iter, index);
return iter->first_child().text().get();
}By analyzing the code context , And combine getString function , It is found that the contents of this field are stored in multiple subordinate nodes , Therefore, the above storage format cannot be processed , We got a problem , Just make a compatible , The modified code is as follows :
const char* XLSharedStrings::getString(uint32_t index) const
{
auto iter = xmlDocument().document_element().children().begin();
std::advance(iter, index);
static std::string t;
t = "";
t = iter->first_child().text().get();
pugi::xml_node iter_r = iter->first_child();
while (!iter_r.empty())
{
if (!strcmp(iter_r.name(), "r"))
{
pugi::xml_node iter_t = iter_r.first_child();
while (!iter_t.empty())
{
if (!strcmp(iter_t.name(), "t"))
{
t = t + iter_t.text().get();
}
iter_t = iter_t.next_sibling();
}
}
iter_r = iter_r.next_sibling();
}
return t.c_str();
}边栏推荐
- 并查集理论讲解和代码实现
- What if the DataGrid cannot see the table after connecting to the database
- Simple use of timeunit
- How to modify the file path of Jupiter notebook under miniconda
- Let me teach you how to develop a graphic editor
- Close of office 365 reading
- Solve tensorfow GPU modulenotfounderror: no module named 'tensorflow_ core. estimator‘
- 纯碱是做什么的?
- 玩转gRPC—深入概念与原理
- 【idea】Could not autowire. No beans of xxx type found
猜你喜欢

Daily Practice:Codeforces Round #794 (Div. 2)(A~D)

Pagoda create multiple sites with one server

CADD course learning (5) -- Construction of chemosynthesis structure with known target (ChemDraw)

Idea to view the source code of jar package and some shortcut keys (necessary for reading the source code)

Build your own random wallpaper API for free

Delayqueue usage and scenarios of delay queue

arcgis_ spatialjoin

行测--资料分析--fb--高照老师
![[idea] efficient plug-in save actions to improve your work efficiency](/img/6e/49037333964865d9900ddf5698f7e6.jpg)
[idea] efficient plug-in save actions to improve your work efficiency

With the help of Navicat for MySQL software, the data of a database table in different or the same database link is copied to another database table
随机推荐
Qu'est - ce que l'hydroxyde de sodium?
Target detection series - detailed explanation of the principle of fast r-cnn
Detour of Tkinter picture scaling
The golang timer uses the stepped pit: the timer is executed once a day
Ggplot2 drawing learning notes in R
Apple system shortcut key usage
苏打粉是什么?
玩转gRPC—深入概念与原理
Rough notes of C language (2) -- constants
String alignment method, self use, synthesis, newrlcjust
golang定时器使用踩的坑:定时器每天执行一次
Reading literature sorting 20220104
cygwin
Mouse click fireworks explosion effect
What does soda ash do?
Deepin, help ('command ') output saved to file
氢氧化钠是什么?
Hdu1231 maximum continuous subsequence (divide and conquer or dynamic gauge or double pointer)
Readme, self study record
目标检测系列——Faster R-CNN原理详解