We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

"New enhanced high speed tables engine"

Can someone please help me make sense of this???

We are deep into the development of a project that is releasing in November. We found some very serious performance problems with cell merging using an older version of Aspose.Slides. It was taking over 4 minutes to just process a single table. So we decided to give the latest version (2.7.0.0) a try since it now sports a "New enhanced high speed tables engine" -- this new engine makes a remarkable performance improvement. what was taking minutes before is now only taking seconds.

However, we are having some serious difficulties understanding:

1. Why the API changed. Why can't you still support the old API?

2. How do even USE the new API to set a CellBorder? We can't even figure out how to use the API any longer. How do I set a blue border that is 2 pixels wide on the top of a cell for example?

http://www.aspose.com/Community/Files/51/aspose.slides/entry95375.aspx

More Info:
From this version we change API for working with tables. We tried to make it as close as possible to previous releases but there are some differences anyway.

  • Temporally it's not possible to delete columns and split cells.
  • CellBorder class has GetEnumerator() method instead of LineFormat property in the previous versions. GetEnumerator retirns iterator for enumerating all Line objects which compose border of a cell.
  • Cell class has new TopLeftCell and BottomRightCell properties to get coordinates of a cell. These properties are equal to each other for normal cells and different for merged cells.

Since the CellBorder class has been changed to have the IEnumerator GetEnumerator() method, it would greatly simplify our calling code if CellBorder also implemented the IEnumerable interface which defines GetEnumerator() so that we could programmatically determine that the class can be enumerated.

Why doesn’t CellBorder implement the IEnumerable interface and can it please be updated to do so?

Thanks

Please check this code that sets the bottom border of the cell to blue color and 2 pixels wide, I have also attached the source presentation generated by it.

**********************************************

Presentation srcPres = new Presentation();

Slide srcSld = srcPres.GetSlideByPosition(1);

Aspose.Slides.Table srcTbl = srcSld.Shapes.AddTable(500, 500, 3000, 2000, 3, 2);

//set the borders to red color and 3 units wide

srcTbl.SetBorders(3, Color.Red);

//get the cell

Aspose.Slides.Cell srcCell = srcTbl.GetCell(2, 1);

//get the bottom border of the cell in a enumerator

IEnumerator myenum = srcCell.BorderBottom.GetEnumerator();

//Iterate enumerator and convert each current item into the

//Aspose.Slides.Line object

//And then change the forecolor and width property

while (myenum.MoveNext())

{

Aspose.Slides.Line ln = myenum.Current as Aspose.Slides.Line;

ln.LineFormat.ForeColor = Color.Blue;

ln.LineFormat.Width = 2;

}

//Write the presentation on disk

srcPres.Write(@"c:\outTbl.ppt");

Thanks Shakeel! This is a big help. We now have a better understanding of how to use the new interface and have been able to code for it.

Thanks, Todd

msfaiz:

Please check this code that sets the bottom border of the cell to blue color and 2 pixels wide, I have also attached the source presentation generated by it.

**********************************************

Presentation srcPres = new Presentation();

Slide srcSld = srcPres.GetSlideByPosition(1);

Aspose.Slides.Table srcTbl = srcSld.Shapes.AddTable(500, 500, 3000, 2000, 3, 2);

//set the borders to red color and 3 units wide

srcTbl.SetBorders(3, Color.Red);

//get the cell

Aspose.Slides.Cell srcCell = srcTbl.GetCell(2, 1);

//get the bottom border of the cell in a enumerator

IEnumerator myenum = srcCell.BorderBottom.GetEnumerator();

//Iterate enumerator and convert each current item into the

//Aspose.Slides.Line object

//And then change the forecolor and width property

while (myenum.MoveNext())

{

Aspose.Slides.Line ln = myenum.Current as Aspose.Slides.Line;

ln.LineFormat.ForeColor = Color.Blue;

ln.LineFormat.Width = 2;

}

//Write the presentation on disk

srcPres.Write(@"c:\outTbl.ppt");

Hi Shakeel

I am using following version of aspose.slides
Aspose.Slides [2.6.6.0]

When I tried above code to set cell border, the following line gave me compilation error.

IEnumerator myenum = srcCell.BorderBottom.GetEnumerator()


It says “GetEnumerator” is not the property of cell. However I was able to use following code.

oTable.GetCell(0, 3).BorderBottom.LineFormat.Width = 0.0;
oTable.GetCell(0, 3).BorderTop.LineFormat.Width = 0.0;

Here oTable is the object of my table.
But this code is not working and is not removing border of the given cell.
=========
Here is what I am trying to do:
1) I have a pre-made PPT with 1 table in it with 1 row.
2) I want to copy the row using addrow() function and then format the copied line as per requirement.
3) After doing “addrow”, I am trying to set following properties in the 1st column cell in it.
- text alignment
- text color
- text style
- remove above and bottom border
4) other things are working fine. But I am not able to remove borders. For some reason, I can not remove borders from the original line.

==========
Following is the code for above things… (assume varibales have set values before)

-------------
// let’s get the required cell first
Aspose.Slides.Cell oCell = oTable.GetCell(0, iRow);

// set alignment
oCell.TextFrame.Paragraphs[0].Alignment = TextAlignment.Right;

// set color
oCell.TextFrame.Paragraphs[0].Portions[0].FontColor = System.Drawing.Color.Black;

// set font to normal
oCell.TextFrame.Paragraphs[0].Portions[0].FontBold = false;

// Now for first col, both above and below border should not be there…
oCell.BorderTop.LineFormat.Width = 0.0;
oCell.BorderBottom.LineFormat.Width = 0.0;

-------------




Dear gotoritesh,

Thanks for considering Aspose.Slides.

The above code mentioned by you is for the versions greater than 2.7.0.0.

For Aspose.Slides for .NET version 2.6.6.0, you should use the following code to hide border line.

oTable.GetCell(0, 3).BorderTop.LineFormat.ShowLines=false;

Hi Shakeel
Thanks for quick reply. I will try this code.
Just a quick ques (though I will try above code).
Will setting “showLines” to false will allow me to remove a perticular border of cell? I just want to remove top and bottom border and not left and right.

I guess that was a silly ques. We are applying this property over a specific border only. :slight_smile: Please ignore it.
It works the way it is expected.
Thanks Shakeel.

The same code in VB.NET

-----------------------------------------------------------------

Dim srcPres As Presentation = New Presentation

Dim srcSld As Slide = srcPres.GetSlideByPosition(1)

Dim srcTbl As Aspose.Slides.Table

srcTbl = srcSld.Shapes.AddTable(500, 500, 3000, 2000, 3, 2)

'set the borders to red color and 3 units wide

srcTbl.SetBorders(3, Drawing.Color.Red)

'get the cell

Dim srcCell As Aspose.Slides.Cell

srcCell = srcTbl.GetCell(2, 1)

'get the bottom border of the cell in a enumerator

Dim myenum As System.Collections.IEnumerator

myenum = srcCell.BorderBottom.GetEnumerator()

'Iterate enumerator and convert each current item into the

'Aspose.Slides.Line object

'And then change the forecolor and width property

While myenum.MoveNext

Dim ln As Aspose.Slides.Line

ln = CType(myenum.Current, Aspose.Slides.Line)

ln.LineFormat.ForeColor = Drawing.Color.Blue

ln.LineFormat.Width = 2

End While

'Write the presentation on disk

srcPres.Write("c:\outTbl.ppt")