1
0
mirror of https://github.com/QtExcel/QXlsx.git synced 2025-01-16 04:42:53 +08:00
QXlsx/TestExcel/datavalidation.cpp

27 lines
595 B
C++
Raw Normal View History

2017-09-16 16:34:45 +09:00
// datavalidation.cpp
2020-06-05 22:20:08 +09:00
#include <QtGlobal>
2017-09-16 12:21:23 +09:00
#include "xlsxdocument.h"
#include "xlsxdatavalidation.h"
2020-06-05 22:20:08 +09:00
QXLSX_USE_NAMESPACE
2017-09-16 12:21:23 +09:00
2017-09-16 16:34:45 +09:00
int datavalidation()
2017-09-16 12:21:23 +09:00
{
Document xlsx;
xlsx.write("A1", "A2 and A3:E5 only accept the number between 33 and 99");
//![1]
DataValidation validation(DataValidation::Whole, DataValidation::Between, "33", "99");
validation.addRange("A2");
validation.addRange("A3:E5");
validation.setPromptMessage("Please Input Integer between 33 and 99");
xlsx.addDataValidation(validation);
//![1]
2017-09-23 11:12:59 +09:00
xlsx.saveAs("datavalidation.xlsx");
2017-09-24 00:09:33 +09:00
2017-09-16 12:21:23 +09:00
return 0;
}