Nice suggestions!
They all logical and smart ;)
Good to know more people are using it.
Many thanks for the ideas
Lino Barreca rašė:
> I have three hints:
>
> First hint:
> In types the properties that expose a list of objects
should not be named
> "<object>collection" but
"<object>s"
> This is the way .net is designed (and any .net
developer is used to do in
> this way)
> For example:
>
> Table.RowCollections should become Table.Rows
> Row.CellCollections should become Row.Cells
> And so on.
>
>
> Second hint:
> Constructors should not create styles if the style is
not specified.
> Example:
> Repetute calls to table.CreateCell() cause AODL to
create a lot of styles.
>
> It should not act this way!
> CreateCell should not add a style at all.
> If I "CreateCell" without a style maybe I
don't want my cell to have a style
> (for example I could use the
"table:default-cell-style-name" attribute to
> apply the same style to every cell, if a new style is
created I can't obtain
> this, or at least, I can but my final document will
contain a lot of unused
> styles)
>
>
> Third hint:
> Styles should not be treated as strings but as
"references"
> Constructors for objects should not accept strings for
style parameters but
> references to other objects implementing IStyle:
> For example:
>
> TextStyle HPStyle = new TextStyle(SD,
"HeaderParagraph");
> HPStyle.TextProperties.FontSize =
"20pt";
> SD.Styles.Add(HPStyle);
>
> CellStyle HCStyle = new CellStyle(SD,
"HeaderCell");
> HCStyle.CellProperties.BorderBottom =
"0.05cm solid
> #000000";
> SD.Styles.Add(HCStyle);
>
> Row headerRow = new Row(table);
> foreach (DataColumn DC in dtb.Columns)
> {
> Cell headerCell =
table.CreateCell("HeaderCell");
> Paragraph paragraph =
> ParagraphBuilder.CreateSpreadsheetParagraph(SD);
> paragraph.StyleName =
"HeaderParagraph";
> paragraph.TextContent.Add(new
SimpleText(SD,
> DC.ColumnName));
> headerCell.Content.Add(paragraph);
>
>
headerRow.CellCollection.Add(headerCell);
> }
> table.RowCollection.Add(headerRow);
>
> Should become:
>
> TextStyle HPStyle = new TextStyle(SD,
"HeaderParagraph");
> HPStyle.TextProperties.FontSize =
"20pt";
> SD.Styles.Add(HPStyle);
>
> CellStyle HCStyle = new CellStyle(SD,
"HeaderCell");
> HCStyle.CellProperties.BorderBottom =
"0.05cm solid
> #000000";
> SD.Styles.Add(HCStyle);
>
> Row headerRow = new Row(table);
> foreach (DataColumn DC in dtb.Columns)
> {
> Cell headerCell =
table.CreateCell(HCStyle);
> Paragraph paragraph =
> ParagraphBuilder.CreateSpreadsheetParagraph(SD,
HPStyle);
> paragraph.TextContent.Add(new
SimpleText(SD,
> DC.ColumnName));
> headerCell.Content.Add(paragraph);
>
>
headerRow.CellCollection.Add(headerCell);
> }
> table.RowCollection.Add(headerRow);
>
> Bye,
> Lino
>
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: dev-unsubscribe odftoolkit.openoffice.org
> For additional commands, e-mail: dev-help odftoolkit.openoffice.org
>
>
------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribe odftoolkit.openoffice.org
For additional commands, e-mail: dev-help odftoolkit.openoffice.org
|