示例#1
0
void ReportSectionDetail::buildXML(QDomDocument & doc, QDomElement & section) {
    // name/title
    QDomElement name = doc.createElement("name");
    name.appendChild(doc.createTextNode(getTitle()));
    section.appendChild(name);

    for(unsigned int i = 0; i < groupList.count(); i++) {
        ReportSectionDetailGroup * rsdg = groupList.at(i);
        QDomNode grp = doc.createElement("group");

        QDomNode gname = doc.createElement("name");
        gname.appendChild(doc.createTextNode(rsdg->getTitle()));
        grp.appendChild(gname);

        QDomNode gcol = doc.createElement("column");
        gcol.appendChild(doc.createTextNode(rsdg->column()));
        grp.appendChild(gcol);

        //group head
        if(rsdg->isGroupHeadShowing()) {
            QDomElement ghead = doc.createElement("head");
            rsdg->getGroupHead()->buildXML(doc,ghead);
            grp.appendChild(ghead);
        }
        // group foot
        if(rsdg->isGroupFootShowing()) {
            QDomElement gfoot = doc.createElement("foot");
            rsdg->getGroupFoot()->buildXML(doc,gfoot);
            grp.appendChild(gfoot);
        }

        section.appendChild(grp);
    }

    // detail section
    QDomElement gdetail = doc.createElement("detail");
    QDomElement key = doc.createElement("key");
    QDomElement kquery = doc.createElement("query");
    kquery.appendChild(doc.createTextNode(query()));
    key.appendChild(kquery);
    gdetail.appendChild(key);
    _detail->buildXML(doc,gdetail);
    section.appendChild(gdetail);

}
示例#2
0
void ReportSectionDetail::buildXML(QDomDocument & doc, QDomElement & section) {
    // name/title
    QDomElement name = doc.createElement("name");
    name.appendChild(doc.createTextNode(getTitle()));
    section.appendChild(name);

    if(pageBreak() != ReportSectionDetail::BreakNone)
    {
      QDomElement spagebreak = doc.createElement("pagebreak");
      if(pageBreak() == ReportSectionDetail::BreakAtEnd)
        spagebreak.setAttribute("when", "at end");
      section.appendChild(spagebreak);
    }

    for(int i = 0; i < groupList.count(); i++) {
        ReportSectionDetailGroup * rsdg = groupList.at(i);
        QDomNode grp = doc.createElement("group");

        QDomNode gname = doc.createElement("name");
        gname.appendChild(doc.createTextNode(rsdg->getTitle()));
        grp.appendChild(gname);

        QDomNode gcol = doc.createElement("column");
        gcol.appendChild(doc.createTextNode(rsdg->column()));
        grp.appendChild(gcol);

        if(rsdg->pageBreak() != ReportSectionDetailGroup::BreakNone)
        {
          QDomElement pagebreak = doc.createElement("pagebreak");
          if(rsdg->pageBreak() == ReportSectionDetailGroup::BreakAfterGroupFooter)
            pagebreak.setAttribute("when", "after foot");
          grp.appendChild(pagebreak);
        }

        //group head
        if(rsdg->isGroupHeadShowing()) {
            QDomElement ghead = doc.createElement("head");
            rsdg->getGroupHead()->buildXML(doc,ghead);
            grp.appendChild(ghead);
        }
        // group foot
        if(rsdg->isGroupFootShowing()) {
            QDomElement gfoot = doc.createElement("foot");
            rsdg->getGroupFoot()->buildXML(doc,gfoot);
            grp.appendChild(gfoot);
        }

        section.appendChild(grp);
    }

    // detail section
    QDomElement gdetail = doc.createElement("detail");
    QDomElement key = doc.createElement("key");
    QDomElement kquery = doc.createElement("query");
    kquery.appendChild(doc.createTextNode(query()));
    key.appendChild(kquery);
    gdetail.appendChild(key);
    _detail->buildXML(doc,gdetail);
    section.appendChild(gdetail);

}