Book Class

Header: #include <Book>
Inherits: ExcelObject

Public Functions

Book(QObject *parent = nullptr)
~Book()
int colorPack(int r, int g, int b)
QString colorUnpack(int color)
  • 31 public functions inherited from QObject

Public Slots

int addCustomNumFormat(const QString &customNumFormat)
Font *addFont(const Font *otherFont = nullptr)
Format *addFormat(const Format *otherFormat = nullptr)
int addPicture(const QString &fileName)
int addPictureAsLink(const QString &fileName, bool insert = false)
Sheet *addSheet(const QString &sheetName, const Sheet *otherSheet = nullptr)
void close()
bool create(const QString &fileName)
double datePack(int year, int month, int day, int hour = 0, int min = 0, int sec = 0, int msec = 0)
QVariantMap dateUnpack(double value)
bool delSheet(int index)
Sheet *getActiveSheet()
QString getCustomNumFormat(int index)
QVariantMap getDefaultFont()
QString getError() const
QString getFileName() const
Font *getFont(int index)
int getFontCount() const
Format *getFormat(int index)
int getFormatCount() const
QString getPicture(int index)
Sheet *getSheet(int index)
Sheet *getSheet(const QString &sheetName)
int getSheetCount() const
Sheet *insertSheet(int index, const QString &sheetName, const Sheet *otherSheet = nullptr)
bool isTemplate() const
bool moveSheet(int fromIndex, int toIndex)
bool open(const QString &fileName, int sheetIndex = -1, int firstRow = 0, int lastRow = -1)
bool save()
bool saveAs(const QString &dstFileName)
void setActiveSheet(int index)
bool setActiveSheet(const QString &sheetName)
void setDefaultFont(const QString &fontName, int fontSize)
void setTemplate(bool tmpl = true)
  • 1 public slot inherited from QObject

Additional Inherited Members

  • 1 property inherited from QObject
  • 2 signals inherited from QObject
  • 1 public variable inherited from QObject
  • 10 static public members inherited from QObject
  • 2 protected functions inherited from ExcelObject
  • 9 protected functions inherited from QObject
  • 2 protected variables inherited from QObject

Detailed Description

Member Function Documentation

Book::Book(QObject *parent = nullptr)

Book::Book parent

Book::~Book()

Destroys the instance of Book.

[slot] int Book::addCustomNumFormat(const QString &customNumFormat)

Book::addCustomNumFormat customNumFormat Returns

[slot] Font *Book::addFont(const Font *otherFont = nullptr)

Book::addFont otherFont Returns

[slot] Format *Book::addFormat(const Format *otherFormat = nullptr)

Book::addFormat otherFormat Returns

[slot] int Book::addPicture(const QString &fileName)

Book::addPicture 支持BMP,DIB,PNG,JPE,WMF格式。 fileName Returns

Book::addPictureAsLink fileName insert Returns

[slot] Sheet *Book::addSheet(const QString &sheetName, const Sheet *otherSheet = nullptr)

[slot] void Book::close()

int Book::colorPack(int r, int g, int b)

QString Book::colorUnpack(int color)

[slot] bool Book::create(const QString &fileName)

[slot] double Book::datePack(int year, int month, int day, int hour = 0, int min = 0, int sec = 0, int msec = 0)

Book::datePack year month day hour min sec msec Returns double 格式的日期。在写日期到单元格中时,使用:


  ...
  Format *dateFormat = book->addFormat();
  dateFormat->setNumberFormat("DATE");
  sheet->writerNum(row,num,book->datePack(2020,9,18),format);

[slot] QVariantMap Book::dateUnpack(double value)

Book::dateUnpack value Returns


  {
    "year": <number>,
    "month": <number>,
    "day": <number>,
    "hour": <number>,
    "min": <number>,
    "sec": <number>,
    "msec": <number>
  }

[slot] bool Book::delSheet(int index)

[slot] Sheet *Book::getActiveSheet()

[slot] QString Book::getCustomNumFormat(int index)

Book::getCustomNumFormat index Returns

[slot] QVariantMap Book::getDefaultFont()

Book::getDefaultFont Returns

[slot] QString Book::getError() const

Book::getError Returns

[slot] QString Book::getFileName() const

[slot] Font *Book::getFont(int index)

Book::getFont index Returns

[slot] int Book::getFontCount() const

Book::getFontCount Returns

[slot] Format *Book::getFormat(int index)

Book::getFormat index Returns

[slot] int Book::getFormatCount() const

Book::getFormatCount Returns

[slot] QString Book::getPicture(int index)

[slot] Sheet *Book::getSheet(int index)

[slot] Sheet *Book::getSheet(const QString &sheetName)

[slot] int Book::getSheetCount() const

[slot] Sheet *Book::insertSheet(int index, const QString &sheetName, const Sheet *otherSheet = nullptr)

[slot] bool Book::isTemplate() const

[slot] bool Book::moveSheet(int fromIndex, int toIndex)

[slot] bool Book::open(const QString &fileName, int sheetIndex = -1, int firstRow = 0, int lastRow = -1)

[slot] bool Book::save()

[slot] bool Book::saveAs(const QString &dstFileName)

[slot] void Book::setActiveSheet(int index)

[slot] bool Book::setActiveSheet(const QString &sheetName)

[slot] void Book::setDefaultFont(const QString &fontName, int fontSize)

Book::setDefaultFont fontName fontSize

[slot] void Book::setTemplate(bool tmpl = true)

See also isTemplate().