czyBlog icon indicating copy to clipboard operation
czyBlog copied to clipboard

wps表格无法写入数据的解决方案

Open Ryzin opened this issue 6 years ago • 1 comments

  • 问题 可能在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都支持
  //其它地方也要修改...
   ...
}



Ryzin avatar Nov 20 '19 04:11 Ryzin

这个是基于office的com组件的wps是否支持我也不清楚

czyt1988 avatar Apr 27 '20 14:04 czyt1988