|
|
| DAAxObjectWordWrapper (QObject *par=nullptr) |
| |
|
void | reloadApp () |
| | 这是调用quit后,如果还要继续操作,可以调用此函数
|
| |
| bool | open (const QString &docfile, bool isvisible=false) |
| | 打开
|
| |
| bool | isInitialize () const |
| | 是否初始化完成
|
| |
| bool | isHaveDocument () const |
| | 是否存在文档
|
| |
|
void | quit () |
| | 退出,正常用户无需手动调用
|
| |
| void | close () |
| | 关闭
|
| |
|
void | save () |
| | 保存
|
| |
| bool | saveAs (const QString &docfile) |
| | 另存
|
| |
| bool | replaceMark (const QString &markName, const QVariant &replaceContent) |
| | 替换标签内容
|
| |
| bool | insertTextAtMark (const QString &markName, const QString &replaceContent) |
| | 在mark(书签)位置添加文本
|
| |
| bool | insertPictureAtMark (const QString &markName, const QString &picturePath) |
| | 在mark(书签)位置添加图片
|
| |
| DAAxObjectWordTableWrapper | insertTableAtMark (const QString &markName, int rowCount, int colCount) |
| | 在书签处插入表格
|
| |
word操作封装
下面这个例子是用dot模板实现word的修改的案例,提前准备好一个word的模板,并定义好标签,通过replaceMark , 以及insertPictureAtMark 等函数即可实现模板的修改
QString templatePath;
...
DAAxObjectWordWrapper word;
if (!word.isInitialize()) {
return;
}
if (!word.open(templatePath)) {
return;
}
word.replaceMark("da_create_year", QDate::currentDate().year());
word.replaceMark("da_create_month", QDate::currentDate().month());
word.insertPictureAtMark("da_picture_air_topology", mTopologyPicturePath);
针对有表格的操作,可以通过insertTableAtMark 函数插入一个表格,返回一个
- 参见
- DAAxObjectWordTableWrapper 对象 ,通过操作
-
DAAxObjectWordTableWrapper 对象实现表格的插入
......
for (int i = 0; i < cc; ++i) {
}
for (int r = 0; r < rr; ++r) {
for (int c = 0; c < cc; ++c) {
}
}
}
针对word的表格的封装
Definition DAAxObjectWordTableWrapper.h:12
bool isNull() const
判断是否为空
Definition DAAxObjectWordTableWrapper.cpp:14
void setCellText(int row, int col, const QString &text)
设置文本,注意,row,col从0开始算
Definition DAAxObjectWordTableWrapper.cpp:95
列族表
Definition DAColumnTable.hpp:19
int rowCount() const
表的行数
Definition DAColumnTable.hpp:228
T cell(int r, int c) const
获取单元格
Definition DAColumnTable.hpp:266
int columnCount() const
表的列数
Definition DAColumnTable.hpp:234
QStringList columnNames() const
colNames
Definition DAColumnTable.hpp:499