AODL.Document.SpreadsheetDocuments.SpreadsheetDocument.Load C# (CSharp) Метод

Load() публичный Метод

Load the given file.
public Load ( string file ) : void
file string
Результат void
		public void Load(string file)
		{
			this._isLoadedFile				= true;
			this.LoadBlankContent();

			this.NamespaceManager			= TextDocumentHelper.NameSpace(this._xmldoc.NameTable);

			ImportHandler importHandler		= new ImportHandler();
			m_importer				= importHandler.GetFirstImporter(DocumentTypes.SpreadsheetDocument, file);

			m_dirInfo = m_importer.DirInfo;
			if (m_importer != null)
			{
				if (m_importer.NeedNewOpenDocument)
					this.New();
				m_importer.Import(this,file);

				if (m_importer.ImportError != null)
					if (m_importer.ImportError.Count > 0)
					foreach(object ob in m_importer.ImportError)
					if (ob is AODLWarning)
				{
					if (((AODLWarning)ob).Message != null)
						Console.WriteLine("Err: {0}", ((AODLWarning)ob).Message);
					if (((AODLWarning)ob).Node != null)
					{
						XmlTextWriter writer	= new XmlTextWriter(Console.Out);
						writer.Formatting		= Formatting.Indented;
						((AODLWarning)ob).Node.WriteContentTo(writer);
					}
				}
			}
		}

Usage Example

Пример #1
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);
		}
All Usage Examples Of AODL.Document.SpreadsheetDocuments.SpreadsheetDocument::Load