Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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

@Ryzin

Description

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


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions