Difference between revisions of "Talk:AODL example 1"
(→Simple Tests show Problems) |
(→Get Exception with 1.3.0.0: new section) |
||
Line 62: | Line 62: | ||
spreadsheetDocument.TableCollection.Add(table) | spreadsheetDocument.TableCollection.Add(table) | ||
spreadsheetDocument.SaveTo("formated.ods") | spreadsheetDocument.SaveTo("formated.ods") | ||
+ | |||
+ | == Get Exception with 1.3.0.0 == | ||
+ | |||
+ | I was not able to get this example to run with the current version 1.3.0.0. The Stack shows following exception: | ||
+ | |||
+ | bei System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32 index) | ||
+ | bei AODL.Document.Content.Tables.RowCollection.get_Item(Int32 index) in D:\downloads\cvs_checkouts\odftoolkit\odftoolkit\aodl\AODL\Document\Content\Tables\RowCollection.cs:Zeile 96. | ||
+ | bei AODL.Document.Content.Tables.Table.InsertCellAt(Int32 rowIndex, Int32 columnIndex, Cell cell) in D:\downloads\cvs_checkouts\odftoolkit\odftoolkit\aodl\AODL\Document\Content\Tables\Table.cs:Zeile 227. | ||
+ | |||
+ | Could you please take a look. THX |
Latest revision as of 08:47, 17 July 2009
I am trying to port this code to VB.NET using Visual Basic 2005 Express Edition, but I'm running into some problems.
I'll just take the first and the last code lines, trying to generate a spreadsheet document, and save it.
Public Class Class1 Dim _spreadsheetDocument As New AODL.Document.SpreadsheetDocuments.SpreadsheetDocument _spreadsheetDocument.SaveTo("formated.ods") End Class
The VisualBasic Editor tells me however, that it expects a declaration.
It would be nice if someone could make a Visual Basic version of the same code, that works.
Contents
Using missing
It would be nice to see which elemets I must bind by Using. So I'bind as following:
using Statement Source
using AODL.Document.SpreadsheetDocuments; using AODL.Document.Collections; using AODL.Document.Content; using AODL.Document.Content.Tables; using AODL.Document.TextDocuments; using AODL.Document.Styles; using AODL.Document.Content.Text;
At the End of USING
I' don't know which is needed but the Compiler gives OK.
Simple Tests show Problems
I was only testing in simple Way this example by manipulating the Row an Column Indexis to see, if it is working. But the Result is frustrating. There is no way to put the Contens in the right Cell.
I was able to run following code in vb.net
'Create new spreadsheet document Dim spreadsheetDocument As SpreadsheetDocuments.SpreadsheetDocument = New SpreadsheetDocument spreadsheetDocument.[New]() 'Create a new table Dim table As Table = New Table(spreadsheetDocument, "First", "tablefirst") 'Create a new cell, without any extra styles Dim cell As Content.Tables.Cell = table.CreateCell() 'Add a paragraph to this cell Dim paragraph As Content.Text.Paragraph = ParagraphBuilder.CreateSpreadsheetParagraph(spreadsheetDocument) 'Create some Formated text Dim fText As 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("formated.ods")
Get Exception with 1.3.0.0
I was not able to get this example to run with the current version 1.3.0.0. The Stack shows following exception:
bei System.Collections.CollectionBase.System.Collections.IList.get_Item(Int32 index) bei AODL.Document.Content.Tables.RowCollection.get_Item(Int32 index) in D:\downloads\cvs_checkouts\odftoolkit\odftoolkit\aodl\AODL\Document\Content\Tables\RowCollection.cs:Zeile 96. bei AODL.Document.Content.Tables.Table.InsertCellAt(Int32 rowIndex, Int32 columnIndex, Cell cell) in D:\downloads\cvs_checkouts\odftoolkit\odftoolkit\aodl\AODL\Document\Content\Tables\Table.cs:Zeile 227.
Could you please take a look. THX