AODL.Document.Import.PlainText.CsvImporter.CreateTables C# (CSharp) Method

CreateTables() private method

Creates the tables.
private CreateTables ( ArrayList lines ) : void
lines System.Collections.ArrayList The lines.
return void
		private void CreateTables(ArrayList lines)
		{
			string unicodeDelimiter				= "\u00BF"; // turned question mark

			if (lines != null)
			{
				Table table						= TableBuilder.CreateSpreadsheetTable(
					(SpreadsheetDocument)this._document, "Table1", "table1");
				//First line must specify the used delimiter
				string delimiter				= lines[0] as string;
				lines.RemoveAt(0);

				try
				{
					//Perform lines
					foreach(string line in lines)
					{
						string lineContent			= line.Replace(delimiter, unicodeDelimiter);
						string[] cellContents		= lineContent.Split(unicodeDelimiter.ToCharArray());
						Row row						= new Row(table);
						foreach(string cellContent in cellContents)
						{
							Cell cell				= new Cell(table.Document);
							Paragraph paragraph		= ParagraphBuilder.CreateSpreadsheetParagraph(this._document);
							paragraph.TextContent.Add(new SimpleText(this._document, cellContent));
							cell.Content.Add(paragraph);
							row.InsertCellAt(row.Cells.Count, cell);
						}
						table.Rows.Add(row);
					}
				}
				catch(Exception ex)
				{
					throw new AODLException("Error while proccessing the csv file.", ex);
				}

				this._document.Content.Add(table);
			}
		}