Skip to content

Commit

Permalink
getImageCount
Browse files Browse the repository at this point in the history
  • Loading branch information
j2doll committed Jul 18, 2020
1 parent 55d3dd8 commit 565e084
Show file tree
Hide file tree
Showing 7 changed files with 32 additions and 3 deletions.
6 changes: 5 additions & 1 deletion IssueTest/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,16 @@ int test95( QVector<QVariant> params )
filename = QString("image %1.png").arg( index );
img.save( filename );

qDebug() << " [image index] " << index;
qDebug() << " [image index] " << index;
}
}

qDebug() << " image count : " << xlsx.getImageCount();
xlsx.saveAs("image1.xlsx");

QXlsx::Document xlsx2("image1.xlsx");
qDebug() << "xlsx2" ;
qDebug() << " image count : " << xlsx.getImageCount();
xlsx2.saveAs("image2.xlsx");

return 0;
Expand Down
1 change: 1 addition & 0 deletions QXlsx/header/xlsxdocument.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ class Document : public QObject

int insertImage(int row, int col, const QImage &image);
bool getImage(int imageIndex, QImage& img);
uint getImageCount();

Chart *insertChart(int row, int col, const QSize &size);

Expand Down
2 changes: 2 additions & 0 deletions QXlsx/header/xlsxworksheet.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ class Worksheet : public AbstractSheet

int insertImage(int row, int column, const QImage &image);
bool getImage(int imageIndex, QImage& img);
uint getImageCount();

Chart *insertChart(int row, int column, const QSize &size);

bool mergeCells(const CellRange &range, const Format &format=Format());
Expand Down
9 changes: 9 additions & 0 deletions QXlsx/source/xlsxdocument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -657,6 +657,15 @@ bool Document::getImage(int imageIndex, QImage& img)
return false;
}

uint Document::getImageCount()
{
if (Worksheet *sheet = currentWorksheet())
return sheet->getImageCount();

return 0;
}


/*!
* Creates an chart with the given \a size and insert it to the current
* active worksheet at the position \a row, \a col.
Expand Down
13 changes: 13 additions & 0 deletions QXlsx/source/xlsxworksheet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1144,6 +1144,19 @@ bool Worksheet::getImage(int imageIndex, QImage& img)
return ret;
}

uint Worksheet::getImageCount()
{
Q_D(Worksheet);

if ( d->drawing == nullptr )
{
return false;
}

int size = d->drawing->anchors.size();
return uint(size);
}



/*!
Expand Down
2 changes: 1 addition & 1 deletion README.ko.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

## 축하
- 우리의 코드가 북극에 갑니다.
![](markdown.data/arcvalut.png)
- ![](markdown.data/arcvalut.png)
- 자세한 정보는 링크를 보세요. https://archiveprogram.github.com/

## :email: 문의
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

## Congratulations
- Our code is going to the North Pole.
![](markdown.data/arcvalut.png)
- ![](markdown.data/arcvalut.png)
- See link for more information. https://archiveprogram.github.com/

## :email: Contact
Expand Down

0 comments on commit 565e084

Please sign in to comment.