czyBlog
czyBlog copied to clipboard
wps表格无法写入数据的解决方案
-
问题 可能在wps 2013以上版本,会遇到无法向xls写入数据的问题。
-
解决方案
//excelbase.cpp
void ExcelBasePrivate::construct() {
...
if (excel->isNull()) {
excel->setControl("ket.Application"); //连接WPS2013以上控件
}
...
}
void ExcelBase::writeCurrentSheet(const QList<QList<QVariant> > &cells) {
...
//将range->setProperty("Value", var); 替换为 range->dynamicCall("SetValue(const QVariant&)", var);
//wps不支持setProperty方式写入,而office都支持
//其它地方也要修改...
...
}
这个是基于office的com组件的wps是否支持我也不清楚