Ejemplo n.º 1
0
        private void setupHAAADerailersTableTemplate()
        {
            String templateDoc = _projecto.Template_Mnemonica;

            String filename = rootPath + "docTemplates\\" + templateDoc + "_DERAILER_HAAA.docx";

            using (WordprocessingDocument tempDoc = WordprocessingDocument.Open(filename, true))
            {

                tempTable = (wp.Table)tempDoc.MainDocumentPart.Document.Body.Elements<wp.Table>().ElementAt(0).Clone();

                // selecciona as linhas
                tempRowHeader = (wp.TableRow)tempTable.Elements<wp.TableRow>().ElementAt(0).Clone();
                tempRowSeparador = (wp.TableRow)tempTable.Elements<wp.TableRow>().ElementAt(1).Clone();
                tempRowHeader2 = (wp.TableRow)tempTable.Elements<wp.TableRow>().ElementAt(2).Clone();
                tempRowImpar = (wp.TableRow)tempTable.Elements<wp.TableRow>().ElementAt(3).Clone();
                tempRowPar = (wp.TableRow)tempTable.Elements<wp.TableRow>().ElementAt(4).Clone();

                // selecciona os símbolos
                // Target
                // Neutro
                // A Desenvolver
                // linhas 3,4 e 5 Coluna 1

                symbDelevop = tempRowImpar.Elements<wp.TableCell>().ElementAt(3).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Elements<wp.SymbolChar>().First() as wp.SymbolChar;
                tempRowImpar.Elements<wp.TableCell>().ElementAt(3).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Elements<wp.SymbolChar>().First().Remove();
                symbNeutral = tempRowPar.Elements<wp.TableCell>().ElementAt(3).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Elements<wp.SymbolChar>().First() as wp.SymbolChar;
                tempRowPar.Elements<wp.TableCell>().ElementAt(3).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Elements<wp.SymbolChar>().First().Remove();

                symbTarget = tempTable.Elements<wp.TableRow>().ElementAt(5).Elements<wp.TableCell>().ElementAt(3).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Elements<wp.SymbolChar>().First() as wp.SymbolChar;
                tempTable.Elements<wp.TableRow>().ElementAt(5).Elements<wp.TableCell>().ElementAt(3).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Elements<wp.SymbolChar>().First().Remove();

                // limpa a tabela
                tempTable.Elements<wp.TableRow>().ElementAt(0).Remove();
                tempTable.Elements<wp.TableRow>().ElementAt(0).Remove();
                tempTable.Elements<wp.TableRow>().ElementAt(0).Remove();
                tempTable.Elements<wp.TableRow>().ElementAt(0).Remove();
                tempTable.Elements<wp.TableRow>().ElementAt(0).Remove();
                tempTable.Elements<wp.TableRow>().ElementAt(0).Remove();

                tempParagraph = tempDoc.MainDocumentPart.Document.Body.Descendants<wp.Paragraph>().ElementAt(0).Clone() as wp.Paragraph;

            }
        }
Ejemplo n.º 2
0
        private void setupHABehaveTableTemplate()
        {
            String templateDoc = _projecto.Template_Mnemonica;

            String filename = rootPath + "docTemplates\\" + templateDoc + "_BEHAVE_HA.docx";

            using (WordprocessingDocument tempDoc = WordprocessingDocument.Open(filename, true))
            {

                tempTable = (wp.Table)tempDoc.MainDocumentPart.Document.Body.Elements<wp.Table>().ElementAt(0).Clone();

                tempRowHeader = (wp.TableRow)tempTable.Elements<wp.TableRow>().ElementAt(0).Clone();
                tempRowHeader2 = (wp.TableRow)tempTable.Elements<wp.TableRow>().ElementAt(1).Clone();
                tempRowImpar = (wp.TableRow)tempTable.Elements<wp.TableRow>().ElementAt(2).Clone();
                tempRowPar = (wp.TableRow)tempTable.Elements<wp.TableRow>().ElementAt(3).Clone();

                symbUp = tempRowImpar.Elements<wp.TableCell>().ElementAt(1).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Elements<wp.SymbolChar>().First() as wp.SymbolChar;
                symbH = tempRowPar.Elements<wp.TableCell>().ElementAt(1).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Elements<wp.SymbolChar>().First() as wp.SymbolChar;
                symbDw = tempTable.Elements<wp.TableRow>().ElementAt(4).Elements<wp.TableCell>().ElementAt(1).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Elements<wp.SymbolChar>().First() as wp.SymbolChar;

                tempTable.Elements<wp.TableRow>().ElementAt(0).Remove();
                tempTable.Elements<wp.TableRow>().ElementAt(0).Remove();
                tempTable.Elements<wp.TableRow>().ElementAt(0).Remove();
                tempTable.Elements<wp.TableRow>().ElementAt(0).Remove();
                tempTable.Elements<wp.TableRow>().ElementAt(0).Remove();

                tempParagraph = tempDoc.MainDocumentPart.Document.Body.Descendants<wp.Paragraph>().ElementAt(0).Clone() as wp.Paragraph;

            }
        }
Ejemplo n.º 3
0
    private void setupGapTables()
    {
        gapTables = true;
        String templateDoc = _projecto.Template_Mnemonica;

        String filename = templatePath + "\\" + templateDoc + "_GAP.docx";
        String[] tempShadingKey = {"T","G1","G2","G3","G4"};

        using (WordprocessingDocument wordDoc = WordprocessingDocument.Open(filename, true))
        {

            tableRankT = (wp.Table)wordDoc.MainDocumentPart.Document.Body.Elements<wp.Table>().ElementAt(0).Clone();
            tableRankB = (wp.Table)wordDoc.MainDocumentPart.Document.Body.Elements<wp.Table>().ElementAt(1).Clone();
            tableRankC = (wp.Table)wordDoc.MainDocumentPart.Document.Body.Elements<wp.Table>().ElementAt(2).Clone();
            tableRankP = (wp.Table)wordDoc.MainDocumentPart.Document.Body.Elements<wp.Table>().ElementAt(3).Clone();
            tableRankO = (wp.Table)wordDoc.MainDocumentPart.Document.Body.Elements<wp.Table>().ElementAt(4).Clone();

            wp.Shading shading = (wp.Shading)tableRankT.Elements<wp.TableRow>().First().Elements<wp.TableCell>().First().Elements<wp.TableCellProperties>().First().Elements<wp.Shading>().First();
            GroupShading.Add(tempShadingKey[0], shading.Fill);
            shading = (wp.Shading)tableRankB.Elements<wp.TableRow>().First().Elements<wp.TableCell>().First().Elements<wp.TableCellProperties>().First().Elements<wp.Shading>().First();
            GroupShading.Add(tempShadingKey[1], shading.Fill);
            shading = (wp.Shading)tableRankC.Elements<wp.TableRow>().First().Elements<wp.TableCell>().First().Elements<wp.TableCellProperties>().First().Elements<wp.Shading>().First();
            GroupShading.Add(tempShadingKey[2], shading.Fill);
            shading = (wp.Shading)tableRankP.Elements<wp.TableRow>().First().Elements<wp.TableCell>().First().Elements<wp.TableCellProperties>().First().Elements<wp.Shading>().First();
            GroupShading.Add(tempShadingKey[3], shading.Fill);
            shading = (wp.Shading)tableRankO.Elements<wp.TableRow>().First().Elements<wp.TableCell>().First().Elements<wp.TableCellProperties>().First().Elements<wp.Shading>().First();
            GroupShading.Add(tempShadingKey[4], shading.Fill);

            trRankRowImpar = (wp.TableRow)tableRankT.Elements<wp.TableRow>().ElementAt(1);
            trRankRowPar = (wp.TableRow)tableRankT.Elements<wp.TableRow>().ElementAt(2);

            symbUp = trRankRowImpar.Elements<wp.TableCell>().ElementAt(3).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Elements<wp.SymbolChar>().First() as wp.SymbolChar;
            symbH = trRankRowPar.Elements<wp.TableCell>().ElementAt(3).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Elements<wp.SymbolChar>().First() as wp.SymbolChar;
            symbDw = tableRankT.Elements<wp.TableRow>().ElementAt(3).Elements<wp.TableCell>().ElementAt(3).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Elements<wp.SymbolChar>().First() as wp.SymbolChar;

            symbUpRun = trRankRowImpar.Elements<wp.TableCell>().ElementAt(3).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Clone() as wp.Run;
            symbHRun = trRankRowPar.Elements<wp.TableCell>().ElementAt(3).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Clone() as wp.Run;
            symbDwRun = tableRankT.Elements<wp.TableRow>().ElementAt(3).Elements<wp.TableCell>().ElementAt(3).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Clone() as wp.Run;

            tableRankT.Elements<wp.TableRow>().ElementAt(1).Remove();
            tableRankT.Elements<wp.TableRow>().ElementAt(1).Remove();
            tableRankT.Elements<wp.TableRow>().ElementAt(1).Remove();

            trRankRowImpar.Elements<wp.TableCell>().ElementAt(3).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Remove();
            trRankRowPar.Elements<wp.TableCell>().ElementAt(3).Elements<wp.Paragraph>().First().Elements<wp.Run>().First().Remove();

            parHeadingParT = (wp.Paragraph)wordDoc.MainDocumentPart.Document.Body.Elements<wp.Paragraph>().ElementAt(0);
            parHeadingParB = (wp.Paragraph)wordDoc.MainDocumentPart.Document.Body.Elements<wp.Paragraph>().ElementAt(1);
            parHeadingParC = (wp.Paragraph)wordDoc.MainDocumentPart.Document.Body.Elements<wp.Paragraph>().ElementAt(2);
            parHeadingParP = (wp.Paragraph)wordDoc.MainDocumentPart.Document.Body.Elements<wp.Paragraph>().ElementAt(3);
            parHeadingParO = (wp.Paragraph)wordDoc.MainDocumentPart.Document.Body.Elements<wp.Paragraph>().ElementAt(4);

        }
    }