InsertCellAt() public method

Inserts the cell at the specified position. The RowCollection, the rows CellCollection and the ColumnCollection will be resized automatically.
public InsertCellAt ( int rowIndex, int columnIndex, Cell cell ) : void
rowIndex int Index of the row.
columnIndex int Index of the column.
cell Cell The cell.
return void
コード例 #1
0
 void Example1()
 {
     //Create new spreadsheet document
     SpreadsheetDocument spreadsheetDocument = new SpreadsheetDocument();
     spreadsheetDocument.New();
     //Create a new table
     Table table = new Table(spreadsheetDocument, "First", "tablefirst");
     //Create a new cell, without any extra styles
     Cell cell = table.CreateCell();
     //Add a paragraph to this cell
     Paragraph paragraph = ParagraphBuilder.CreateSpreadsheetParagraph(spreadsheetDocument);
     //Create some Formated text
     FormatedText fText = new FormatedText(spreadsheetDocument, "T1", "Some Text");
     //fText.TextStyle.TextProperties.Bold = "bold";
     fText.TextStyle.TextProperties.Underline = LineStyles.dotted;
     //Add formated text
     paragraph.TextContent.Add(fText);
     //Add paragraph to the cell
     cell.Content.Add(paragraph);
     //Insert the cell at row index 2 and column index 3
     //All need rows, columns and cells below the given
     //indexes will be build automatically.
     table.InsertCellAt(2, 3, cell);
     //Insert table into the spreadsheet document
     spreadsheetDocument.TableCollection.Add(table);
     spreadsheetDocument.SaveTo("example1_formated.ods");
 }
コード例 #2
0
ファイル: Test1.cs プロジェクト: rabidbob/aodl-reloaded
		public  void CreateRowsAndColumns()
		{
			SpreadsheetDocument doc = new SpreadsheetDocument ();
			doc.New ();
			Table table = new Table (doc,"tab1","tab1");
			
			for(int i=1; i<=4; i++)
			{
				for(int j=1; j<=5;j++)
				{
					Cell cell = table.CreateCell ();
					cell.OfficeValueType ="float";
					Paragraph paragraph = new Paragraph (doc);
					string text= (j+i-1).ToString();
					paragraph.TextContent .Add (new SimpleText ( doc,text));
					cell.Content.Add(paragraph);
					cell.OfficeValueType = "string";
					cell.OfficeValue = text;
					
					table.InsertCellAt (i, j, cell);
				}
			}
			
			Assert.AreEqual(5, table.Rows.Count);
			for (int i = 1; i < 4; i++)
			{
				Row row = table.Rows[i];
				Assert.AreEqual(6, row.Cells.Count);
			}
			
		}
コード例 #3
0
ファイル: Test1.cs プロジェクト: rabidbob/aodl-reloaded
		public  void AutomaticallCreateRows()
		{
			SpreadsheetDocument doc = new SpreadsheetDocument ();
			doc.New ();
			Table table = new Table (doc,"tab1","tab1");
			
			for(int i=1; i<=1; i++)
			{
				for(int j=1; j<=1;j++)
				{
					Cell cell = table.CreateCell ();
					cell.OfficeValueType ="float";
					Paragraph paragraph = new Paragraph (doc);
					string text= (j+i-1).ToString();
					paragraph.TextContent .Add (new SimpleText ( doc,text));
					cell.Content.Add(paragraph);
					cell.OfficeValueType = "string";
					cell.OfficeValue = text;
					
					table.InsertCellAt (i, j, cell);
				}
			}
			
			// test that we have this number of rows and cells
			Assert.AreEqual(2, table.Rows.Count);
			for (int i = 1; i < table.Rows.Count; i++)
			{
				Row row = table.Rows[i];
				Assert.AreEqual(2, row.Cells.Count);
			}
			
			
			// force to insert more cells
			table.InsertCellAt(5, 5, table.CreateCell () );
			
			// assert, that the cells were added
			Assert.AreEqual(6, table.Rows.Count);
			for (int i = 0; i < table.Rows.Count; i++)
			{
				Row row = table.Rows[i];
				Assert.AreEqual(6, row.Cells.Count);
			}
			
		}
コード例 #4
0
		public  void CreateNewChart()
			
		{
			SpreadsheetDocument doc = new SpreadsheetDocument ();
			doc.New ();
			Table table = new Table (doc,"tab1","tab1");
			
			for(int i=1; i<=1; i++)
			{
				for(int j=1; j<=6;j++)
				{
					Cell cell = table.CreateCell ();
					cell.OfficeValueType ="float";
					Paragraph paragraph = new Paragraph (doc);
					string text= (j+i-1).ToString();
					paragraph.TextContent .Add (new SimpleText ( doc,text));
					cell.Content.Add(paragraph);
					cell.OfficeValueType = "string";
					cell.OfficeValue = text;
					table.InsertCellAt (i, j, cell);
				}
			}
			
			Chart chart=ChartBuilder.CreateChartByAxisName
				(table,ChartTypes.bar ,"A1:E4","years","dollars");
			Assert.AreEqual(7, table.Rows[1].Cells.Count);
			Assert.AreEqual(6, table.Rows[2].Cells.Count);
			Assert.AreEqual(6, table.Rows[3].Cells.Count);
			Assert.AreEqual(6, table.Rows[4].Cells.Count);
			/*Chart chart = new Chart (table,"ch1");
			chart.ChartType=ChartTypes.bar .ToString () ;
			chart.XAxisName ="yeer";
			chart.YAxisName ="dollar";
			chart.CreateFromCellRange ("A1:E4");
			chart.EndCellAddress ="tab1.K17";*/
			table.InsertChartAt ("G2",chart);
			
			doc.Content .Add (table);
			doc.SaveTo(Path.Combine(AARunMeFirstAndOnce.outPutFolder, @"NewChartOne.ods"));
		}
コード例 #5
0
ファイル: ODSExporter.cs プロジェクト: guidgets/XamlGrid
 public override void Export(IEnumerable<List<CellInfo>> exportInfo)
 {
     SpreadsheetDocument spreadsheetDocument = new SpreadsheetDocument();
     spreadsheetDocument.New();
     Table table = new Table(spreadsheetDocument, "DataGrid", string.Empty);
     int rowIndex = 0;
     foreach (List<CellInfo> cellInfos in exportInfo)
     {
         for (int columnIndex = 0; columnIndex < cellInfos.Count; columnIndex++)
         {
             CellInfo cellInfo = cellInfos[columnIndex];
             Cell cell = table.CreateCell();
             Paragraph paragraph = ParagraphBuilder.CreateSpreadsheetParagraph(spreadsheetDocument);
             SimpleText fText = new SimpleText(spreadsheetDocument, (cellInfo.Value ?? string.Empty).ToString());
             paragraph.TextContent.Add(fText);
             cell.Content.Add(paragraph);
             table.InsertCellAt(rowIndex, columnIndex, cell);
         }
         rowIndex++;
     }
     spreadsheetDocument.TableCollection.Add(table);
     Save(spreadsheetDocument);
 }
コード例 #6
0
		/// <summary>
		/// gets the rowIndex and colIndex of the chart according to the name of the cell
		/// </summary>
		/// <param name="cellName"></param>
		/// <param name="tableData"></param>
		/// <returns></returns>


		public CellPos  GetCellPos(string cellName,Table tableData)
		{
			int  i = 0;
			int  columnIndex = 0;
			int  rowIndex    = 0;
			char[] columnStr = new char [2];
			string rowStr    = null;
			
			foreach(char c in cellName)
			{
				if (c>='A'&&c<='Z')
				{
					columnStr[i]=c;
					i++;
				}
			}

			if (i==1)
				columnIndex = columnStr[0]-'A';
			if (i==2)
				columnIndex=(columnStr[0]-'A')*26 +(columnStr[1]-'A');
			columnIndex    = columnIndex+1;

			rowStr    = cellName.Substring (i);
			rowIndex  = Int32.Parse (rowStr);

			Cell cell = null;

			if (rowIndex<=tableData.Rows .Count )
			{
				Row row = tableData.Rows [rowIndex-1];
				if (columnIndex<=row.Cells.Count )
				{
					cell= tableData.Rows [rowIndex-1].Cells [columnIndex-1];
				}
			}

			if (cell==null)
			{
				cell = new Cell(_document);
				tableData.InsertCellAt (rowIndex,columnIndex,cell);
			}

			CellPos    pos = new CellPos ();

			pos.cell =cell;
			pos.columnIndex = columnIndex;
			pos.rowIndex    = rowIndex;
			return pos;
		}
コード例 #7
0
		public void SpreadSheetFormsTest()
		{
			//Create new spreadsheet document
			SpreadsheetDocument spreadsheetDocument		= new SpreadsheetDocument();
			spreadsheetDocument.New();
			//Create a new table
			Table table					= new Table(spreadsheetDocument, "First", "tablefirst");
			//Create a new cell, without any extra styles 
			Cell cell								= new Cell(spreadsheetDocument, "cell001");
			cell.OfficeValueType					= "string";
			//Set full border
			cell.CellStyle.CellProperties.Border	= Border.NormalSolid;			
			//Add a paragraph to this cell
			Paragraph paragraph						= ParagraphBuilder.CreateSpreadsheetParagraph(
				spreadsheetDocument);
			//Add some text content
			paragraph.TextContent.Add(new SimpleText(spreadsheetDocument, "Some text"));
			//Add paragraph to the cell
			cell.Content.Add(paragraph);
			//Insert the cell at row index 2 and column index 3
			//All need rows, columns and cells below the given
			//indexes will be build automatically.
			table.Rows.Add(new Row(table, "Standard"));
			table.Rows.Add(new Row(table, "Standard"));
			table.Rows.Add(new Row(table, "Standard"));
			table.InsertCellAt(3, 2, cell);
			//Insert table into the spreadsheet document
			
			ODFForm main_form = new ODFForm(spreadsheetDocument, "mainform");
			main_form.Method = Method.Get;
			ODFButton butt = new ODFButton(main_form, cell.Content, "butt", "0cm", "0cm", "15mm", "8mm");
			butt.Label = "test :)";
			main_form.Controls.Add (butt);
			spreadsheetDocument.TableCollection.Add(table);
			table.Forms.Add(main_form);
			
			spreadsheetDocument.SaveTo(AARunMeFirstAndOnce.outPutFolder+"spreadsheet_forms.ods");

			SpreadsheetDocument spreadsheetDocument2		= new SpreadsheetDocument();
			spreadsheetDocument2.Load(AARunMeFirstAndOnce.outPutFolder+"spreadsheet_forms.ods");
			ODFButton b = spreadsheetDocument2.TableCollection[0].FindControlById("butt") as ODFButton;
			Assert.IsNotNull(b);
			b.Label = "it works!";
			spreadsheetDocument2.SaveTo(AARunMeFirstAndOnce.outPutFolder+"spreadsheet_forms2.ods");
		}
コード例 #8
0
		public void CreateSimpleTable()
		{
			//Create new spreadsheet document
			_spreadsheetDocument2		= new SpreadsheetDocument();
			_spreadsheetDocument2.Load(AARunMeFirstAndOnce.inPutFolder+@"blank.ods");
			//Create a new table
			Table table					= new Table(_spreadsheetDocument2, "First", "tablefirst");
			table.Rows.Add(new Row(table));
			//Create a new cell, without any extra styles 
			Cell cell								= new Cell(_spreadsheetDocument2, "cell001");
			cell.OfficeValueType					= "string";
			//Set full border
			cell.CellStyle.CellProperties.Border	= Border.NormalSolid;			
			//Add a paragraph to this cell
			Paragraph paragraph						= ParagraphBuilder.CreateSpreadsheetParagraph(
				_spreadsheetDocument2);
			//Add some text content
			String cellText = "Some text";
			paragraph.TextContent.Add(new SimpleText(_spreadsheetDocument2, cellText));
			//Add paragraph to the cell
			cell.Content.Add(paragraph);
			//Insert the cell at row index 2 and column index 3
			//All need rows, columns and cells below the given
			//indexes will be build automatically.
			table.InsertCellAt(1, 1, cell);
			//Insert table into the spreadsheet document
			_spreadsheetDocument2.TableCollection.Add(table);
			// Test inserted content
			Assert.AreEqual(_spreadsheetDocument2.TableCollection[0], table);
			String text = _spreadsheetDocument2.TableCollection[0].Rows[1].Cells[1].Node.InnerText;
			Assert.AreEqual(text, cellText);
		}
コード例 #9
0
		public void CreateTableFormatedText()
		{
			//Create new spreadsheet document
			_spreadsheetDocument3		= new SpreadsheetDocument();
			_spreadsheetDocument3.Load(AARunMeFirstAndOnce.inPutFolder+@"blank.ods");
			//Create a new table
			Table table					= new Table(_spreadsheetDocument3, "First", "tablefirst");
			table.Rows.Add(new Row(table));
			//Create a new cell, without any extra styles 
			Cell cell								= table.CreateCell();
			cell.OfficeValueType					= "string";
			//Set full border
			//cell.CellStyle.CellProperties.Border	= Border.NormalSolid;			
			//Add a paragraph to this cell
			Paragraph paragraph						= ParagraphBuilder.CreateSpreadsheetParagraph(
				_spreadsheetDocument3);
			//Create some Formated text
			FormatedText fText						= new FormatedText(_spreadsheetDocument3, "T1", "Some Text");
			//fText.TextStyle.TextProperties.Bold		 = "bold";
			fText.TextStyle.TextProperties.Underline = LineStyles.dotted;
			//Add formated text
			paragraph.TextContent.Add(fText);
			//Add paragraph to the cell
			cell.Content.Add(paragraph);
			//Insert the cell at row index 2 and column index 3
			//All need rows, columns and cells below the given
			//indexes will be build automatically.
			table.InsertCellAt(2, 3, cell);
			//Insert table into the spreadsheet document
			_spreadsheetDocument3.TableCollection.Add(table);
			// Test inserted content
			Object insertedText = ((Paragraph)_spreadsheetDocument3.TableCollection[0].Rows[2].Cells[3].Content[0]).TextContent[0];
			Assert.AreEqual(fText, insertedText as FormatedText);
		}
コード例 #10
0
 public void CreateTableFormatedText()
 {
     //Create new spreadsheet document
     SpreadsheetDocument spreadsheetDocument		= new SpreadsheetDocument();
     spreadsheetDocument.New();
     //Create a new table
     Table table					= new Table(spreadsheetDocument, "First", "tablefirst");
     //Create a new cell, without any extra styles
     Cell cell								= table.CreateCell();
     //cell.OfficeValueType					= "string";
     //Set full border
     //cell.CellStyle.CellProperties.Border	= Border.NormalSolid;
     //Add a paragraph to this cell
     Paragraph paragraph						= ParagraphBuilder.CreateSpreadsheetParagraph(
         spreadsheetDocument);
     //Create some Formated text
     FormatedText fText						= new FormatedText(spreadsheetDocument, "T1", "Some Text");
     //fText.TextStyle.TextProperties.Bold		 = "bold";
     fText.TextStyle.TextProperties.Underline = LineStyles.dotted;
     //Add formated text
     paragraph.TextContent.Add(fText);
     //Add paragraph to the cell
     cell.Content.Add(paragraph);
     //Insert the cell at row index 2 and column index 3
     //All need rows, columns and cells below the given
     //indexes will be build automatically.
     table.InsertCellAt(2, 3, cell);
     //Insert table into the spreadsheet document
     spreadsheetDocument.TableCollection.Add(table);
     spreadsheetDocument.SaveTo(AARunMeFirstAndOnce.outPutFolder+"formated.ods");
 }
コード例 #11
0
        public void NewBasicChartThenSetTitle()
        {
            string expected="Basic Chart";
            SpreadsheetDocument doc = new SpreadsheetDocument();
            doc.New();
            Table table = new Table(doc, "tab1", "tab1");

            for (int i = 1; i <= 1; i++)
            {
                for (int j = 1; j <= 6; j++)
                {
                    Cell cell = table.CreateCell();
                    cell.OfficeValueType = "float";
                    Paragraph paragraph = new Paragraph(doc);
                    string text = (j + i - 1).ToString();
                    paragraph.TextContent.Add(new SimpleText(doc, text));
                    cell.Content.Add(paragraph);
                    cell.OfficeValueType = "string";
                    cell.OfficeValue = text;
                    table.InsertCellAt(i, j, cell);
                }
            }
            Chart basicChart = ChartBuilder.CreateChart(table, ChartTypes.line, "A4:F8");
            ChartTitle ct = new ChartTitle(basicChart);
            //ct.InitTitle();
            ct.SetTitle(expected);
            Assert.AreEqual(expected, ((Paragraph)ct.Content[0]).TextContent[0].Text);
            basicChart.ChartTitle = ct;
            IContent chartTitleContent = null;
            chartTitleContent=basicChart.Content.Find(o => o is ChartTitle);
            if (chartTitleContent == null)
            {
                foreach (IContent iContent in basicChart.Content)
                {
                    if (iContent is ChartTitle) chartTitleContent = iContent;
                }
            }
            Assert.AreEqual(expected, ((Paragraph)((ChartTitle)chartTitleContent).Content[0]).TextContent[0].Text);
            table.InsertChartAt("H2", basicChart);
            doc.TableCollection.Add(table);
            doc.SaveTo(Path.Combine(AARunMeFirstAndOnce.outPutFolder,"BasicChartWithTitlesetafterwards.ods"));
        }
コード例 #12
0
ファイル: class_crea_ods.cs プロジェクト: nagyistge/osiris
        public class_traslate_spreadsheet(string query_sql, string[] args_names_field, string[] args_type_field, bool typetext, string[] args_field_text, string name_field_text, bool more_title, string[] args_more_title)
        {
            //Console.WriteLine(name_field_text+" nombre del campo");
            int files_field = 0;

            string [] array_field_text = new string[args_field_text.Length];
            connectionString = conexion_a_DB._url_servidor + conexion_a_DB._port_DB + conexion_a_DB._usuario_DB + conexion_a_DB._passwrd_user_DB;
            nombrebd         = conexion_a_DB._nombrebd;
            //Create new spreadsheet open document (.ods)
            AODL.Document.SpreadsheetDocuments.SpreadsheetDocument spreadsheetDocument = new AODL.Document.SpreadsheetDocuments.SpreadsheetDocument();
            spreadsheetDocument.New();
            //Create a new table
            AODL.Document.Content.Tables.Table table = new AODL.Document.Content.Tables.Table(spreadsheetDocument, "hoja1", "tablefirst");
            NpgsqlConnection conexion;

            conexion = new NpgsqlConnection(connectionString + nombrebd);
            // Verifica que la base de datos este conectada
            try{
                conexion.Open();
                NpgsqlCommand comando;
                comando             = conexion.CreateCommand();
                comando.CommandText = query_sql;
                Console.WriteLine(comando.CommandText);
                comando.ExecuteNonQuery();    comando.Dispose();
                NpgsqlDataReader lector = comando.ExecuteReader();
                // Creando los nombres de ancabezado de los campos
                for (int colum_field = 0; colum_field < args_names_field.Length; colum_field++)
                {
                    AODL.Document.Content.Tables.Cell cell = table.CreateCell();
                    //cell.OfficeValueType ="float";
                    AODL.Document.Content.Text.Paragraph paragraph = new AODL.Document.Content.Text.Paragraph(spreadsheetDocument);
                    string text = (string)args_names_field[colum_field].ToString().Trim();
                    paragraph.TextContent.Add(new AODL.Document.Content.Text.SimpleText(spreadsheetDocument, text));
                    cell.Content.Add(paragraph);
                    cell.OfficeValueType = "string";
                    cell.OfficeValue     = text;
                    table.InsertCellAt(files_field, colum_field, cell);
                }
                if (typetext == true)
                {
                    // Creando los nombres de ancabezado de los campos cuando son de tipo text (almacenado en una tabla tipo text)
                    for (int colum_field2 = 0; colum_field2 < args_field_text.Length; colum_field2++)
                    {
                        AODL.Document.Content.Tables.Cell cell = table.CreateCell();
                        //cell.OfficeValueType ="float";
                        AODL.Document.Content.Text.Paragraph paragraph = new AODL.Document.Content.Text.Paragraph(spreadsheetDocument);
                        string text = (string)args_field_text[colum_field2].ToString().Trim();
                        paragraph.TextContent.Add(new AODL.Document.Content.Text.SimpleText(spreadsheetDocument, text));
                        cell.Content.Add(paragraph);
                        cell.OfficeValueType = "string";
                        cell.OfficeValue     = text;
                        table.InsertCellAt(files_field, colum_field2 + args_names_field.Length, cell);
                    }
                }
                if (more_title == true)
                {
                    int title_field_text = 0;
                    if (typetext == true)
                    {
                        title_field_text = args_field_text.Length;
                    }
                    // Creando los nombres de ancabezado de los campos cuando son de tipo text (almacenado en una tabla tipo text)
                    for (int colum_field3 = 0; colum_field3 < args_more_title.Length; colum_field3++)
                    {
                        AODL.Document.Content.Tables.Cell cell = table.CreateCell();
                        //cell.OfficeValueType ="float";
                        AODL.Document.Content.Text.Paragraph paragraph = new AODL.Document.Content.Text.Paragraph(spreadsheetDocument);
                        string text = (string)args_more_title[colum_field3].ToString().Trim();
                        paragraph.TextContent.Add(new AODL.Document.Content.Text.SimpleText(spreadsheetDocument, text));
                        cell.Content.Add(paragraph);
                        cell.OfficeValueType = "string";
                        cell.OfficeValue     = text;
                        table.InsertCellAt(files_field, colum_field3 + args_names_field.Length + title_field_text, cell);
                    }
                }
                files_field++;
                string texto = "";
                while (lector.Read())
                {
                    for (int colum_field = 0; colum_field < args_names_field.Length; colum_field++)
                    {
                        AODL.Document.Content.Tables.Cell cell = table.CreateCell();
                        //cell.OfficeValueType ="float";
                        AODL.Document.Content.Text.Paragraph paragraph = new AODL.Document.Content.Text.Paragraph(spreadsheetDocument);
                        string text = lector[(string)args_names_field[colum_field]].ToString().Trim();
                        paragraph.TextContent.Add(new AODL.Document.Content.Text.SimpleText(spreadsheetDocument, text));
                        cell.Content.Add(paragraph);
                        cell.OfficeValueType = (string)args_type_field [colum_field];
                        cell.OfficeValue     = text;
                        table.InsertCellAt(files_field, colum_field, cell);
                    }
                    if (typetext == true)
                    {
                        texto = (string)lector[name_field_text];                // puede ser una campo de la base de datos tipo Text
                        char[] delimiterChars  = { '\n' };                      // delimitador de Cadenas
                        char[] delimiterChars1 = { ';' };                       // delimitador de Cadenas
                        //string texto = "1;daniel; ;olivares;cuevas";
                        //"2;genaro;cuevas;bazaldua\n"+
                        //"3;gladys;perez;orellana\n";
                        string[] words = texto.Split(delimiterChars);                         // Separa las Cadenas
                        if (texto != "")
                        {
                            // Recorre la variable
                            foreach (string s in words)
                            {
                                if (s.Length > 0)
                                {
                                    string   texto1 = (string)s;
                                    string[] words1 = texto1.Split(delimiterChars1);
                                    //for (int i = 1; i <= 6; i++){
                                    int i  = 0;
                                    int i2 = 1;
                                    foreach (string s1 in words1)
                                    {
                                        //Console.WriteLine(s1.ToString());
                                        if (i2 <= args_field_text.Length)
                                        {
                                            array_field_text[i] = s1.ToString();
                                        }
                                        i++;
                                        i2++;
                                    }
                                }
                            }
                            for (int i = 0; i < array_field_text.Length; i++)
                            {
                                //Console.WriteLine(array_field_text[i]);
                                AODL.Document.Content.Tables.Cell cell = table.CreateCell();
                                //cell.OfficeValueType ="float";
                                AODL.Document.Content.Text.Paragraph paragraph = new AODL.Document.Content.Text.Paragraph(spreadsheetDocument);
                                string text = (string)array_field_text[i];
                                paragraph.TextContent.Add(new AODL.Document.Content.Text.SimpleText(spreadsheetDocument, text));
                                cell.Content.Add(paragraph);
                                cell.OfficeValueType = "string";
                                cell.OfficeValue     = text;
                                table.InsertCellAt(files_field, i + args_names_field.Length, cell);
                            }
                        }
                        else
                        {
                        }
                    }
                    files_field++;
                }
                conexion.Close();
                //Insert table into the spreadsheet document
                spreadsheetDocument.TableCollection.Add(table);
                spreadsheetDocument.SaveTo("export.ods");
                // open the document automatic
                System.Diagnostics.Process.Start("export.ods");
            }catch (NpgsqlException ex) {
                MessageDialog msgBoxError = new MessageDialog(MyWinError, DialogFlags.DestroyWithParent,
                                                              MessageType.Error,
                                                              ButtonsType.Close, "PostgresSQL error: {0}", ex.Message);
                msgBoxError.Run();             msgBoxError.Destroy();
            }

            /*
             * // Leyendo el archivo .ods
             * spreadsheetDocument.Load("export.ods");
             * Assert.IsNotNull(spreadsheetDocument.TableCollection, "Table collection must exits.");
             * //Assert.IsTrue(spreadsheetDocument.TableCollection.Count == 6, "There must be 3 tables available.");
             *
             * int paso = spreadsheetDocument.TableCollection.Count;
             *
             * Console.WriteLine(paso.ToString());
             * int i2 = 0; // current row index
             * int ii = 0; // current cell index
             * string innerText = ""; // current inner text
             * try{
             *      //Assert.IsTrue(spreadsheetDocument.TableCollection[0].Rows.Count == 5, "There must be 6 rows available.");
             *      for(i2= 0; i2 < spreadsheetDocument.TableCollection[0].Rows.Count; i2++){
             *              string contents = "Row " + i2 + ": ";
             *              //Assert.IsTrue(spreadsheetDocument.TableCollection[0].Rows[i2].Cells.Count == 3, "There must be 3 cells available.");
             *              for(ii = 0; ii < spreadsheetDocument.TableCollection[0].Rows[i2].Cells.Count; ii++){
             *                      innerText = spreadsheetDocument.TableCollection[0].Rows[i2].Cells[ii].Node.InnerText;
             *                      if (spreadsheetDocument.TableCollection[0].Rows[i2].Cells[ii].OfficeValue != null){
             *                              contents += spreadsheetDocument.TableCollection[0].Rows[i2].Cells[ii].OfficeValue.ToString() + " ";
             *                      }else{
             *                              contents += innerText + " ";
             *                      }
             *              }
             *              Console.WriteLine(contents);
             *      }
             * }catch(System.Exception ex){
             *      string where = "occours in Row " + i2.ToString() + " and cell " + ii.ToString() + " last cell content " + innerText + "\n\n";
             *      Console.WriteLine(where + ex.Message + "\n\n" + ex.StackTrace);
             * }
             */

            /*
             * // Usando libreria SmartXLS
             * WorkBook book = new WorkBook();
             *
             * try{
             *      //Sets the number of worksheets in this workbook
             * book.NumSheets = 2;
             * // set sheet names
             * book.setSheetName(0, "hoja1");	// renombrando la pestaña
             *      book.setSheetName(1, "hoja2");	// renombrando la pestaña
             *      book.Sheet = 0;
             *      // book.setText(Fila, columna , "texto");
             *      book.setText(0, 0, "foliodeservicio");
             *      book.setText(0, 1, "descripcion_producto");
             *      book.setText(0, 2, "idproducto");
             *      book.setText(0, 3, "cantidadaplicada");
             *      book.setText(0, 4, "preciounitario");
             *      book.setText(0, 5, "ppcantidad");
             *      book.setText(0, 6, "fechcreacion");
             *      book.setText(0, 7, "descripcion_admisiones");
             *      book.setText(0, 8, "idtipoadmision");
             *      book.setText(0, 9, "descripcion_grupo_producto");
             *      book.setText(0, 10, "aplicar_iva");
             *
             *      NpgsqlConnection conexion;
             *      conexion = new NpgsqlConnection (connectionString+nombrebd);
             * // Verifica que la base de datos este conectada
             *      try{
             *              conexion.Open ();
             *              NpgsqlCommand comando;
             *              comando = conexion.CreateCommand ();
             *              comando.CommandText = "SELECT osiris_erp_cobros_deta.folio_de_servicio AS foliodeservicio,descripcion_producto,to_char(osiris_erp_cobros_deta.id_producto,'999999999999') AS idproducto, "+
             *                      "to_char(osiris_erp_cobros_deta.cantidad_aplicada,'99999.99') AS cantidadaplicada,to_char(osiris_erp_cobros_deta.precio_producto,'99999999.99') AS preciounitario,"+
             *                              "to_char(osiris_erp_cobros_deta.cantidad_aplicada * osiris_erp_cobros_deta.precio_producto,'99999999.99') AS ppcantidad,"+
             *                              "to_char(osiris_erp_cobros_deta.fechahora_creacion,'dd-MM-yyyy HH24:mi:ss') AS fechcreacion, osiris_his_tipo_admisiones.descripcion_admisiones,"+
             *                              "osiris_erp_cobros_deta.id_tipo_admisiones AS idtipoadmision,descripcion_grupo_producto,osiris_productos.aplicar_iva," +
             *                              "to_char(osiris_erp_cobros_deta.id_secuencia,'9999999999') AS secuencia " +
             *                              "FROM osiris_erp_cobros_deta,osiris_productos,osiris_his_tipo_admisiones,osiris_grupo_producto " +
             *                              "WHERE osiris_erp_cobros_deta.id_producto = osiris_productos.id_producto " +
             *                              "AND osiris_erp_cobros_deta.id_tipo_admisiones = osiris_his_tipo_admisiones.id_tipo_admisiones " +
             *                              "AND osiris_productos.id_grupo_producto = osiris_grupo_producto.id_grupo_producto " +
             *                              "AND osiris_erp_cobros_deta.eliminado = false " +
             *                              "AND osiris_erp_cobros_deta.folio_de_servicio IN('"+numeroatencion_+"') " +
             *                              "ORDER BY to_char(osiris_erp_cobros_deta.fechahora_creacion,'yyyy-MM-dd HH24:mm:ss'),osiris_erp_cobros_deta.id_tipo_admisiones ASC," +
             *                               "osiris_productos.id_grupo_producto;";
             *              comando.ExecuteNonQuery();    comando.Dispose();
             *              //Console.WriteLine(comando.CommandText);
             *              NpgsqlDataReader lector = comando.ExecuteReader ();
             *              while (lector.Read()){
             *                      book.setNumber(number_file, 0, int.Parse(numeroatencion_));
             *                      book.setText(number_file, 1, (string) lector["descripcion_producto"]);
             *                      book.setText(number_file, 2, (string) lector["idproducto"]);
             *                      number_file++;
             *              }
             *              conexion.Close();
             *              book.write("export.xls");
             *
             *              System.Diagnostics.Process.Start("export.xls");
             *
             *
             *      }catch(NpgsqlException ex){
             *                      MessageDialog msgBoxError = new MessageDialog (MyWinError,DialogFlags.DestroyWithParent,
             *                                                      MessageType.Error,
             *                                                      ButtonsType.Close,"PostgresSQL error: {0}",ex.Message);
             *                      msgBoxError.Run ();		msgBoxError.Destroy();
             *      }
             *
             *
             * }catch (System.Exception ex){
             * Console.Error.WriteLine(ex);
             * }
             */
        }