Есть XML файл со структурой:
<Worksheet ss:Name="Заказ">
<Table ss:DefaultRowHeight="15" ss:StyleID="s62" x:FullRows="1" x:FullColumns="1" ss:ExpandedRowCount="24" ss:ExpandedColumnCount="6">
<Column ss:StyleID="s62" ss:Width="78.75"/>
<Column ss:StyleID="s62" ss:Span="3" ss:Width="59.25"/>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s115">
<Data ss:Type="String">№ п/п</Data>
</Cell>
<Cell ss:StyleID="m39498460" ss:MergeAcross="1">
<Data ss:Type="String">Наименование</Data>
</Cell>
<Cell ss:StyleID="s124">
<Data ss:Type="String">Кол-во</Data>
</Cell>
<Cell ss:StyleID="s115">
<Data ss:Type="String">Цена</Data>
</Cell>
<Cell ss:StyleID="s115">
<Data ss:Type="String">Стоимость</Data>
</Cell>
</Row>
<Row ss:Height="12.75" ss:AutoFitHeight="0">
<Cell ss:StyleID="s125">
<Data ss:Type="String">{PARTORDER}</Data>
</Cell>
<Cell ss:StyleID="m39498480" ss:MergeAcross="1"/>
<Cell ss:StyleID="s126"/>
<Cell ss:StyleID="s127"/>
<Cell ss:StyleID="s127"/>
</Row>
<Row ss:Height="12.75" ss:AutoFitHeight="0">
<Cell ss:StyleID="s110" ss:Index="2"/>
<Cell ss:StyleID="s110"/>
<Cell ss:StyleID="m39498500" ss:MergeAcross="1">
<Data ss:Type="String">Всего к оплате:</Data>
</Cell>
<Cell ss:StyleID="s127"/>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s110" ss:Index="2"/>
<Cell ss:StyleID="s110"/>
</Row>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
Нахожу в этом структуре раздел:
<Row ss:Height="12.75" ss:AutoFitHeight="0">
<Cell ss:StyleID="s125">
<Data ss:Type="String">{PARTORDER}</Data>
</Cell>
<Cell ss:StyleID="m39498480" ss:MergeAcross="1"/>
<Cell ss:StyleID="s126"/>
<Cell ss:StyleID="s127"/>
<Cell ss:StyleID="s127"/>
</Row>
Вот мне его необходимо повторить несколько раз так чтоб получилась следующая структура файла:
<Worksheet ss:Name="Заказ">
<Table ss:DefaultRowHeight="15" ss:StyleID="s62" x:FullRows="1" x:FullColumns="1" ss:ExpandedRowCount="24" ss:ExpandedColumnCount="6">
<Column ss:StyleID="s62" ss:Width="78.75"/>
<Column ss:StyleID="s62" ss:Span="3" ss:Width="59.25"/>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s115">
<Data ss:Type="String">№ п/п</Data>
</Cell>
<Cell ss:StyleID="m39498460" ss:MergeAcross="1">
<Data ss:Type="String">Наименование</Data>
</Cell>
<Cell ss:StyleID="s124">
<Data ss:Type="String">Кол-во</Data>
</Cell>
<Cell ss:StyleID="s115">
<Data ss:Type="String">Цена</Data>
</Cell>
<Cell ss:StyleID="s115">
<Data ss:Type="String">Стоимость</Data>
</Cell>
</Row>
<Row ss:Height="12.75" ss:AutoFitHeight="0">
<Cell ss:StyleID="s125">
<Data ss:Type="String">{PARTORDER}</Data>
</Cell>
<Cell ss:StyleID="m39498480" ss:MergeAcross="1"/>
<Cell ss:StyleID="s126"/>
<Cell ss:StyleID="s127"/>
<Cell ss:StyleID="s127"/>
</Row>
<Row ss:Height="12.75" ss:AutoFitHeight="0">
<Cell ss:StyleID="s125">
<Data ss:Type="String">{PARTORDER}</Data>
</Cell>
<Cell ss:StyleID="m39498480" ss:MergeAcross="1"/>
<Cell ss:StyleID="s126"/>
<Cell ss:StyleID="s127"/>
<Cell ss:StyleID="s127"/>
</Row>
<Row ss:Height="12.75" ss:AutoFitHeight="0">
<Cell ss:StyleID="s125">
<Data ss:Type="String">{PARTORDER}</Data>
</Cell>
<Cell ss:StyleID="m39498480" ss:MergeAcross="1"/>
<Cell ss:StyleID="s126"/>
<Cell ss:StyleID="s127"/>
<Cell ss:StyleID="s127"/>
</Row>
<Row ss:Height="12.75" ss:AutoFitHeight="0">
<Cell ss:StyleID="s125">
<Data ss:Type="String">{PARTORDER}</Data>
</Cell>
<Cell ss:StyleID="m39498480" ss:MergeAcross="1"/>
<Cell ss:StyleID="s126"/>
<Cell ss:StyleID="s127"/>
<Cell ss:StyleID="s127"/>
</Row>
<Row ss:Height="12.75" ss:AutoFitHeight="0">
<Cell ss:StyleID="s110" ss:Index="2"/>
<Cell ss:StyleID="s110"/>
<Cell ss:StyleID="m39498500" ss:MergeAcross="1">
<Data ss:Type="String">Всего к оплате:</Data>
</Cell>
<Cell ss:StyleID="s127"/>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s110" ss:Index="2"/>
<Cell ss:StyleID="s110"/>
</Row>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
Пытаюсь это реализовать с помощью следующего кода:
QDomDocument domDoc;
{Загружаю данные в файл}
QDomNodeList ListRow = domDoc.elementsByTagName("Cell");
for (int i = 0; i < ListRow.count(); ++i) {
//QDomElement domElement = ListRow.at(i).firstChild();
QDomNode n = ListRow.at(i).firstChild();
while (!n.isNull()) {
if (n.isElement()) {
QDomElement e = n.toElement();
if(e.text()=="{PARTORDER}"){
QDomNode CloneNode = e.parentNode().parentNode().cloneNode(true);
qDebug()<<QString::number(CloneNode.childNodes().size());
domDoc.insertAfter(CloneNode,e.parentNode().parentNode());
domDoc.insertAfter(CloneNode,e.parentNode().parentNode());
}
}
n = n.nextSibling();
}
if( !file1.open( QIODevice::WriteOnly) ){
qDebug( "Failed to open file for writing." );
return;
}
QTextStream stream( &file1 );
stream << domDoc.toString();
file1.close();
Новых строк в файле я не вижу. Почему?
insertAfter() написано что "Returns a new reference to newChild on success or a null node on failure."
Можете проверить, что возвращает.
Могу посоветовать попробовать через
QDomNode QDomNode::appendChild ( const QDomNode & newChild ).
ДА возврашает NUll.Но мне необходимо добавит копию узла в заданную позицию. Я привел часть XML файла болле полная структура файла:
<?xml version='1.0'?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet">
<DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
<Version>12.00</Version>
</DocumentProperties>
<OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
<Colors>
<Color>
<Index>3</Index>
<RGB>#000000</RGB>
</Color>
<Color>
<Index>4</Index>
<RGB>#C0C0C0</RGB>
</Color>
<Color>
<Index>5</Index>
<RGB>#FF0000</RGB>
</Color>
<Color>
<Index>6</Index>
<RGB>#FFFF00</RGB>
</Color>
</Colors>
</OfficeDocumentSettings>
<ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
<WindowHeight>9000</WindowHeight>
<WindowWidth>13860</WindowWidth>
<WindowTopX>240</WindowTopX>
<WindowTopY>75</WindowTopY>
<ProtectStructure>False</ProtectStructure>
<ProtectWindows>False</ProtectWindows>
</ExcelWorkbook>
<Styles>
<Style ss:ID="Default" ss:Name="Normal">
<Alignment ss:Vertical="Bottom"/>
<Borders/>
<Font ss:Size="11" ss:Color="#000000" ss:FontName="Calibri" x:CharSet="204" x:Family="Swiss"/>
<Interior/>
<NumberFormat/>
<Protection/>
</Style>
<Style ss:ID="s62" ss:Name="Default"/>
<Style ss:ID="s67" ss:Name="Normal">
<Font ss:Size="11" ss:Color="#000000" ss:FontName="Calibri"/>
</Style>
<Style ss:ID="m39498624" ss:Parent="s67">
<Alignment ss:Horizontal="Left" ss:Vertical="Center"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:Bold="1" ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="m39498400" ss:Parent="s67">
<Alignment ss:Horizontal="Left" ss:Vertical="Center"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="m39498420" ss:Parent="s67">
<Alignment ss:Horizontal="Right" ss:Vertical="Center"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="m39498460" ss:Parent="s67">
<Alignment ss:Horizontal="Center" ss:Vertical="Center"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="m39498480" ss:Parent="s67">
<Alignment ss:Horizontal="Left" ss:Vertical="Center"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="m39498500" ss:Parent="s67">
<Alignment ss:Horizontal="Left" ss:Vertical="Center"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="m39498176" ss:Parent="s67">
<Alignment ss:Horizontal="Left" ss:Vertical="Center"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="m39498196" ss:Parent="s67">
<Alignment ss:Horizontal="Right" ss:Vertical="Center"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="m39498216" ss:Parent="s67">
<Alignment ss:Horizontal="Left" ss:Vertical="Center"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="m39498236" ss:Parent="s67">
<Alignment ss:Horizontal="Right" ss:Vertical="Center"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:Bold="1" ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="m39498256" ss:Parent="s67">
<Alignment ss:Horizontal="Left" ss:Vertical="Center"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="m39498276" ss:Parent="s67">
<Alignment ss:Horizontal="Right" ss:Vertical="Center"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="m39498032" ss:Parent="s67">
<Alignment ss:Horizontal="Left" ss:Vertical="Center"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="m39498052" ss:Parent="s67">
<Alignment ss:Horizontal="Right" ss:Vertical="Center"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:Bold="1" ss:FontName="Ubuntu"/>
<NumberFormat ss:Format="Short Date"/>
</Style>
<Style ss:ID="s70" ss:Parent="s67">
<Alignment ss:Horizontal="Left" ss:Vertical="Center"/>
<Font ss:Italic="1" ss:Underline="Single" ss:Bold="1" ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="s110" ss:Parent="s67">
<Font ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="s111" ss:Parent="s67">
<Alignment ss:Horizontal="Right" ss:Vertical="Center"/>
<Font ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="s113" ss:Parent="s67">
<Alignment ss:Horizontal="Center" ss:Vertical="Center"/>
<Font ss:Bold="1" ss:FontName="Ubuntu"/>
<Interior ss:Color="#FFFF00" ss:Pattern="Solid"/>
</Style>
<Style ss:ID="s115" ss:Parent="s67">
<Alignment ss:Horizontal="Center" ss:Vertical="Center"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:Italic="1" ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="s124" ss:Parent="s67">
<Alignment ss:Horizontal="Center" ss:Vertical="Center" ss:WrapText="1"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:Italic="1" ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="s125" ss:Parent="s67">
<Alignment ss:Horizontal="Center" ss:Vertical="Bottom"/>
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="s126" ss:Parent="s67">
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="s127" ss:Parent="s67">
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Ubuntu"/>
<NumberFormat/>
</Style>
<Style ss:ID="s128" ss:Parent="s67">
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:Bold="1" ss:FontName="Ubuntu"/>
</Style>
<Style ss:ID="s129" ss:Parent="s67">
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:FontName="Ubuntu"/>
<NumberFormat ss:Format="Percent"/>
</Style>
<Style ss:ID="s136" ss:Parent="s67">
<Borders>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Bottom"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Left"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Right"/>
<Border ss:Weight="1" ss:Color="#000000" ss:LineStyle="Continuous" ss:Position="Top"/>
</Borders>
<Font ss:Bold="1" ss:FontName="Ubuntu"/>
<NumberFormat/>
</Style>
<Style ss:ID="s138" ss:Parent="s67">
<Alignment ss:Horizontal="Center" ss:Vertical="Center"/>
<Font ss:Size="12" ss:Bold="1" ss:FontName="Ubuntu"/>
</Style>
</Styles>
<Worksheet ss:Name="Заказ">
<Table ss:DefaultRowHeight="15" ss:StyleID="s62" x:FullRows="1" x:FullColumns="1" ss:ExpandedRowCount="24" ss:ExpandedColumnCount="6">
<Column ss:StyleID="s62" ss:Width="78.75"/>
<Column ss:StyleID="s62" ss:Span="3" ss:Width="59.25"/>
<Row ss:Height="12.75" ss:AutoFitHeight="0">
<Cell ss:StyleID="s70" ss:MergeAcross="5">
<Data ss:Type="String"></Data>
</Cell>
</Row>
<Row ss:Height="12.75" ss:AutoFitHeight="0">
<Cell ss:StyleID="s125">
<Data ss:Type="String">{PARTORDER}</Data>
</Cell>
<Cell ss:StyleID="m39498480" ss:MergeAcross="1"/>
<Cell ss:StyleID="s126"/>
<Cell ss:StyleID="s127"/>
<Cell ss:StyleID="s127"/>
</Row>
<Row ss:Height="12.75" ss:AutoFitHeight="0">
<Cell ss:StyleID="s110" ss:Index="2"/>
<Cell ss:StyleID="s110"/>
<Cell ss:StyleID="m39498624" ss:MergeAcross="1">
<Data ss:Type="String">Итого к оплате:</Data>
</Cell>
<Cell ss:StyleID="s136"/>
</Row>
<Row ss:AutoFitHeight="0">
<Cell ss:StyleID="s110" ss:Index="2"/>
<Cell ss:StyleID="s110"/>
</Row>
</Table>
<WorksheetOptions xmlns="urn:schemas-microsoft-com:office:excel">
<Selected/>
<Panes>
<Pane>
<Number>3</Number>
<ActiveRow>15</ActiveRow>
<ActiveCol>4</ActiveCol>
</Pane>
</Panes>
<ProtectObjects>False</ProtectObjects>
<ProtectScenarios>False</ProtectScenarios>
</WorksheetOptions>
<x:WorksheetOptions/>
</Worksheet>
</Workbook>
Это структура файла Таблица xml 2003.
Обратите внимание на доку:
QDomNode QDomNode::insertAfter ( const QDomNode & newChild, const QDomNode & refChild )
Inserts the node newChild after the child node refChild. refChild must be a
direct child of this node. If refChild is null then newChild is appended as this node's last child.
Следовательно, нужно написать не
domDoc.insertAfter(CloneNode,e.parentNode().parentNode());
а
QDomNode tableNode = domDoc.elementsByTagName("Table").at(0); //где-то до начала цикла
tableNode.insertAfter(CloneNode, e.parentNode().parentNode());
ибо родительским элементом для Row является Table.
В этом случае вставляются элементы, правильно или нет это уже вы смотрите.
Но хочу предупредить, что если будете пробовать, цикл напишите
int countCells = ListRow.count();
for (int i = 0; i < countCells; ++i) {
ибо у меня цикл оказался вечным, если изначально не посчитать переменную.