Office 2007 is Applying Table Styles to Generated PP File

V

Vincent

I have a tool that I've written that generates PowerPoint slides from data in
a database.

This was originally written when my site was on Office 2003. Everyone has
now been moved over to Office 2007.

The trouble is, Office 2007 seems to be distorting various text sizes and
table formatting.

The most troubling is that it seems to be applying some sort of table style
to tables that I just want to be black and white.

After the document is generated, going to the "Design" tab in the Ribbon and
selecting "Clear Table" restores the table back, but I can't figure out how
to do this programmatically.

Any thoughts?
 
V

Vincent

Fair enough!

Basically, on a slide, I'm placing a table by doing the following:

PP.Shape tmp = (PP.Shape)ipp.createTable(slide, 4, 2, new RectangleF(0.5f,
2f, 2f, 3f));

Where PP = Microsoft.Office.Interop.PowerPoint

and the createTable function looks like:

public PP.Shape createTable(PP.Slide slide, int numRows, int
numCols, RectangleF rect)
{
float x = rect.Location.X * 72;
float y = rect.Location.Y * 72;
float width = rect.Width * 72;
float height = rect.Height * 72;

PP.Shape t =
slide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, x,
y, width, height);
PP.Shape table = slide.Shapes.AddTable(numRows, numCols, x, y,
width, height);

return table;
}

Then it's just a matter of writing data in the table...so for the first cell
of the first row:

TheTable.Columns[1].Cells[1].Shape.TextFrame.TextRange.Text =
"Foobar";
TheTable.Columns[1].Cells[1].Shape.TextFrame.TextRange.Font.Bold
= MsoTriState.msoTrue;
TheTable.Columns[1].Cells[1].Shape.TextFrame.TextRange.Font.Size
= 16f;
ipp.applyAlignment(TheTable.Columns[1].Cells[1].Shape.TextFrame);

The end result is that, in PP 2003, the table comes out to be just a normal
looking black and white table. In PP 2007, the table is two shades of blue
(one for the "header" -- which isn't a header, it's just the first row of
data, and a second shade for the rest of it) because PP seems to have
automatically applied a style to the table.

I have no idea how in code I might be able to clear the style.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top