List Info

Thread: Re: Hints for AODL




Re: Hints for AODL
user name
2007-07-13 06:38:04
Hi Lino,

first of course thanks for your suggestions 

Darius Damalakas wrote:
> 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.
>>

Yes, you're right, but I guess its nothing what any
developer will 
confuse to much.

>>
>> 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)
>>

You can also create table cells without styles. e.g.

Table table = new Table(doc, "table1",
"table1");
table.TableStyle.TableProperties.Width	= width;

for(int i=0; i<3; i++){
	Column column = new Column(table,
"co"+i.ToString());
	column.ColumnStyle.ColumnProperties.Width = 			
		GetColumnCellWidth(3, dWidth);
	table.ColumnCollection.Add(column);
}

for(int ir=0; ir<3; ir++){
	Row row = new Row(table, null);
	for(int ic=0; ic<3; ic++){
		// null == no cell style
		Cell cell = new Cell(table, null);
		Paragraph p = 	
	ParagraphBuilder.CreateStandardTextParagraph(doc);
		p.TextContent.Add(new SimpleText(doc,
		ir.ToString() + "::" + ic.ToString()));
		cell.Content.Add(p);
		row.CellCollection.Add(cell);
	}
	table.RowCollection.Add(row);
}


>>
>> 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);

Yes, this is also a thinkable way, but up to now we see no
need to 
change the way of our implementation.

At least, I hope that this mail doesn't look like I would
block any 
suggestions. We were really happy about any feedback, so
thank you for 
your feedback.

Regards
Lars

>>
>> Bye,
>> Lino
>>
>>
------------------------------------------------------------
---------
>> To unsubscribe, e-mail: dev-unsubscribeodftoolkit.openoffice.org
>> For additional commands, e-mail: dev-helpodftoolkit.openoffice.org
>>
>>
> 
>
------------------------------------------------------------
---------
> To unsubscribe, e-mail: dev-unsubscribeodftoolkit.openoffice.org
> For additional commands, e-mail: dev-helpodftoolkit.openoffice.org
> 

------------------------------------------------------------
---------
To unsubscribe, e-mail: dev-unsubscribeodftoolkit.openoffice.org
For additional commands, e-mail: dev-helpodftoolkit.openoffice.org


[1]

about | contact  Other archives ( Real Estate discussion Medical topics )