QT使用QXlsx实现数据验证与Excel公式操作 QT基础入门【Excel的操作】

 准备环境:QT中使用QtXlsx库的三种方法

1、公式操作写单行公式

    //右值初始化
    Format rAlign;
    rAlign.setHorizontalAlignment(Format::AlignRight);
    //左值初始化
    Format lAlign;
    lAlign.setHorizontalAlignment(Format::AlignLeft);
    
    xlsx.write("B3", 40, lAlign);
    xlsx.write("B4", 30, lAlign);
    xlsx.write("B5", 50, lAlign);
    xlsx.write("A7", "SUM(B3:B5)=", rAlign);
    xlsx.write("B7", "=SUM(B3:B5)", lAlign);
    xlsx.write("A8", "AVERAGE(B3:B5)=", rAlign);
    xlsx.write("B8", "=AVERAGE(B3:B5)", lAlign);
    xlsx.write("A9", "MAX(B3:B5)=", rAlign);
    xlsx.write("B9", "=MAX(B3:B5)", lAlign);
    xlsx.write("A10", "MIN(B3:B5)=", rAlign);
    xlsx.write("B10", "=MIN(B3:B

你可能感兴趣的:(QT基础入门,qt,excel,数据库)