728x90
요즘에 QXlsx를 이용해서 프로그램의 실행 결과를 자동으로 엑셀로 만들어주는 기능을 작업하고 있습니다.
이때 Summary 시트의 결과 셀을 누르면 Log 시트의 특정 Cell로 이동하게 만들고 싶어서 Hyperlink 코드 추가했습니다.
Url을 "#시트이름!셀"로 넣고 마지막 "text" 부분에 실제 표시할 텍스트를 넣어주시면 됩니다.
#include <xlsxdocument.h>
#include <xlsxworksheet.h>
{
...;
auto currentSheet = reportFile.currentWorksheet();
QXlsx::Format linkFormat;
linkFormat.setFontColor(Qt::blue);
linkFormat.setFontUnderline(QXlsx::Format::FontUnderlineSingle);
QString sLogCellUrl = QString("#%1!A%2").arg("Log", QString::number(Row));
currentSheet->writeHyperlink(nRow, nColumn++, QUrl(sLogCellUrl), linkFormat, "text");
...;
}
728x90
'Programming > Qt' 카테고리의 다른 글
[Qt] QTreewidget 메모리 해제 없이 비우기 (0) | 2024.11.27 |
---|---|
[Qt] QtConcurrent mappedReduced 사용하기 (0) | 2024.11.08 |
[Qt] QTreeWiget Data Json 형태로 Save/Load 하는 방법 (0) | 2024.11.06 |
[Qt] 다른 쓰레드에서 QTimer 처리하기 (1) | 2024.10.22 |
[Qt] QTableWidget header 정보는 남기고 내용만 지우기 (0) | 2024.07.18 |