C ++ QT范围的excel querySubObject [英] c++ qt range of excel querySubObject

查看:218
本文介绍了C ++ QT范围的excel querySubObject的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将数据从Qt写入excel文件.我发现这段代码使我可以将数据写入5 * 5范围.

I try to write Data from Qt into an excel-File. I found this piece of code letting me write my Data into an 5*5 range.

//get a 5x5 range of cells : from A1 to E5
QAxObject *range = sheet1->querySubObject( "Range(const QString&, const QString&)", QString("A1"), QString("f5")); 
QVariant vTable(table);
range->dynamicCall("SetValue(const QVariant&)", vTable);

我的数据比5列和5行大得多,并且大小各异.是否可以用数字设置范围,例如:

My data is much bigger than 5 colums and 5 rows and varies in size. Is there a possibility of setting the range with numbers something like:

QAxObject *range = sheet1->querySubObject( "Range(7,123)"); 

意味着我的数据应具有7列和123行的大小?

meaning my data should have the size of 7 columns and 123 rows ?

非常感谢您的回答

很好

推荐答案

如果您的数据是123x7表,则可以将范围初始化为

If your data is 123x7 table then you can initialize your range as

QAxObject *range = sheet1->querySubObject( "Range(A1,G123)");

假设您将值存储在vTable中,则可以调用:

Assuming that you are storing your values in vTable then you can call :

range->dynamicCall("setValue(const QVariant&)",vTable); 

将您的值添加到电子表格中.

to put your values to spreadsheet.

这篇关于C ++ QT范围的excel querySubObject的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆