Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Make tables in word
Message
From
04/01/2007 14:55:55
 
 
To
04/01/2007 14:40:33
Mike Cole
Yellow Lab Technologies
Stanley, Iowa, United States
General information
Forum:
ASP.NET
Category:
Other
Environment versions
Environment:
C# 2.0
Miscellaneous
Thread ID:
01182405
Message ID:
01182481
Views:
12
yes , but i need insert a table on my documente i've this code :
 Word.Application oWord = null;
            Word.Document oDoc = null;
            Word.Paragraph oParagraph = null;
            Word.Paragraph oParagraph2 = null;
            Word.Paragraph oTitle = null;
            DataTable dtFields = new DataTable();
            object oMissing = Missing.Value;
            
            int _Posicion = 0;
            _Tamanio = dtData.Rows.Count;
            oWord = new Word.ApplicationClass();
            
           
            oDoc=oWord.Documents.Add(ref oMissing, ref oMissing, ref oMissing, ref oMissing);
            //oRange=oDoc.Range(ref oStart,ref oEnd);
            //oTable = oDoc.Tables.Add(oRange, 10, 10,ref 10,ref 5);
            foreach (DataRow drFilas in dtData.Rows)
            {
                oTitle = oDoc.Content.Paragraphs.Add(ref oMissing);
                //Adiciona Los titulos
                oTitle.Range.Text = "Nombre de Campo    Tipo ";
                oTitle.Range.Font.Bold = 1;
                oTitle.Range.Font.Size = 24;
                oTitle.Range.InsertParagraphAfter();
                //Adiciona el Nombre de La tabla
                oParagraph = oDoc.Content.Paragraphs.Add(ref oMissing);
                oParagraph.Range.Text = drFilas["TableName"].ToString();
                oParagraph.Range.Font.Bold = 1;
                oParagraph.Range.Font.Size = 14;
                //oParagraph.Format.SpaceAfter = 24;
                oParagraph.Range.InsertParagraphAfter();
                //Calcula el progreso
                _Posicion++;
                _Progreso = _Posicion;
                dtFields=oData.FieldNames(drFilas["TableName"].ToString());

                foreach (DataRow drFields in dtFields.Rows)
                {
                    oParagraph2 = oDoc.Content.Paragraphs.Add(ref oMissing);
                    oParagraph2.Range.Text = drFields["column_name"].ToString() + "   " + drFields["data_type"].ToString() +
                        "    " + drFields["character_octet_length"].ToString();
                    oParagraph2.Range.Font.Size = 10;

                    oParagraph2.Range.Font.Bold = 0;
                    oParagraph2.Range.InsertParagraphAfter();
                }
                
            }
            oWord.Visible = true;
            oWord = null;
            oParagraph = null;
            oParagraph2 = null;
Daniel Vargas.
MCP - Microsoft Certified Professional

"El callar y escuchar es cosa de sabios por ello nuestro grito nace de silencio consciente fuerte y elocuente... vivir de manera diferente es morir siendo libre"

Elkin Ramirez-Kraken

My Blog
Previous
Reply
Map
View

Click here to load this message in the networking platform