You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.
# pragma once
# include <QtCore>
# include <QAxBase>
# include <QAxObject>
# include "Defines.h"
# include "iPlugin_global.h"
// 该类实现word的导出, 主要借助dot模板来实现
class I_PLUGIN_EXPORT WordEngine : public QObject
{
Q_OBJECT
public :
WordEngine ( ) ;
~ WordEngine ( ) ;
// 加载Dot文件, 如果为空, 则新建一个
bool open ( QString sDotFile , bool bVisible = false ) ;
// 替换标签(文本)
bool replaceText ( QString sTag , QString sText ) ;
// 替换标签(图片)
bool replaceImg ( QString sTag , QString sImgFile ) ;
// 替换标签(表格)
// 如果listHeaders为空, 则默认vvecData第一行为标题
// 否则listHeaders为标题, vvecData全部为数据
bool replaceTable ( QString sTag , \
VVecVariant & vvecData , \
QStringList listHeaders = QStringList ( ) ) ;
// 保存
void saveAs ( QString sFile ) ;
private :
// 获取标签
QAxObject * getBookmarkOf ( QString sTag ) ;
// 表格相关操作
QAxObject * insertTableOf ( QString sTag , int r , int c ) ;
bool setTableCellStr ( QAxObject * pTable , int r , int c , QString s ) ;
bool setTableCellTextBold ( QAxObject * pTable , int r , int c , bool b ) ;
QAxObject * getTableCell ( QAxObject * pTable , int r , int c ) ;
// 释放内存
void release ( ) ;
private :
// word about
QAxObject * m_pAxWord ;
QAxObject * m_pAxDocs ;
QAxObject * m_pAxDoc ;
// Assit infos
QString m_sFile ;
bool m_bOpen ;
bool m_bNewDoc ;
} ;