Skip to content

Commit 565e084

Browse files
committed
getImageCount
1 parent 55d3dd8 commit 565e084

File tree

7 files changed

+32
-3
lines changed

7 files changed

+32
-3
lines changed

IssueTest/test.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,16 @@ int test95( QVector<QVariant> params )
4949
filename = QString("image %1.png").arg( index );
5050
img.save( filename );
5151

52-
qDebug() << " [image index] " << index;
52+
qDebug() << " [image index] " << index;
5353
}
5454
}
55+
56+
qDebug() << " image count : " << xlsx.getImageCount();
5557
xlsx.saveAs("image1.xlsx");
5658

5759
QXlsx::Document xlsx2("image1.xlsx");
60+
qDebug() << "xlsx2" ;
61+
qDebug() << " image count : " << xlsx.getImageCount();
5862
xlsx2.saveAs("image2.xlsx");
5963

6064
return 0;

QXlsx/header/xlsxdocument.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class Document : public QObject
4343

4444
int insertImage(int row, int col, const QImage &image);
4545
bool getImage(int imageIndex, QImage& img);
46+
uint getImageCount();
4647

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

QXlsx/header/xlsxworksheet.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,6 +99,8 @@ class Worksheet : public AbstractSheet
9999

100100
int insertImage(int row, int column, const QImage &image);
101101
bool getImage(int imageIndex, QImage& img);
102+
uint getImageCount();
103+
102104
Chart *insertChart(int row, int column, const QSize &size);
103105

104106
bool mergeCells(const CellRange &range, const Format &format=Format());

QXlsx/source/xlsxdocument.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -657,6 +657,15 @@ bool Document::getImage(int imageIndex, QImage& img)
657657
return false;
658658
}
659659

660+
uint Document::getImageCount()
661+
{
662+
if (Worksheet *sheet = currentWorksheet())
663+
return sheet->getImageCount();
664+
665+
return 0;
666+
}
667+
668+
660669
/*!
661670
* Creates an chart with the given \a size and insert it to the current
662671
* active worksheet at the position \a row, \a col.

QXlsx/source/xlsxworksheet.cpp

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1144,6 +1144,19 @@ bool Worksheet::getImage(int imageIndex, QImage& img)
11441144
return ret;
11451145
}
11461146

1147+
uint Worksheet::getImageCount()
1148+
{
1149+
Q_D(Worksheet);
1150+
1151+
if ( d->drawing == nullptr )
1152+
{
1153+
return false;
1154+
}
1155+
1156+
int size = d->drawing->anchors.size();
1157+
return uint(size);
1158+
}
1159+
11471160

11481161

11491162
/*!

README.ko.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

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

5555
## :email: 문의

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

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

5555
## :email: Contact

0 commit comments

Comments
 (0)