static string[] headerColumns = new string[] { "A", "B", "C" }; //the columns being accessed public static Row CreateContentRow(int index, int year, int pSQ, int death) { Row r = new Row(); r.RowIndex = (UInt32)index; //skipping the text add function //we are createing a cell for each column (headerColumns), //for each cell we are adding a value. //we then append the value to the cell and append the cell to the row - wich is returned. for (int i = 0; i < headerColumns.Length; i++) { Cell c = new Cell(); c.CellReference = headerColumns[i] + index; CellValue v = new CellValue(); if (i == 0) { v.Text = year.ToString(); } else if (i == 1) { v.Text = pSQ.ToString(); } else if (i == 2) { v.Text = death.ToString(); } c.AppendChild(v); r.AppendChild(c); } return(r); }
//Method for when the datatype is text based public Cell CreateTextCell(string header, string text, int index) { //Create a new inline string cell. Cell c = new Cell(); c.DataType = CellValues.InlineString; c.CellReference = header + index; //Add text to the text cell. InlineString inlineString = new InlineString(); Text t = new Text(); t.Text = text; inlineString.AppendChild(t); c.AppendChild(inlineString); return(c); }