Creating PowerPoint files via C# and COM Interop RRS feed

  • Question

  • Hi there,

    this is very urgent and I really don't know, what I can do more. I want to build a PowerPoint file using ASP.NET and #C. That works fine with this COM Library, but I'm not able to fill a textbox with a specific color. The only way I found in the web is this one:

    private void ppt_addPhaseName(PowerPoint.Slide slide, String name)
        PowerPoint.Shape shape = slide.Shapes.AddTextbox(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationVerticalFarEast, 0f, 0f, 32.0f, 65.0f);
        shape.Fill.ForeColor.RGB = System.Drawing.Color.Black.ToArgb();
        shape.TextFrame.TextRange.Text = name;
        shape.TextFrame.TextRange.Font.Color.RGB = System.Drawing.Color.White.ToArgb();
        shape.TextFrame.TextRange.Font.Size = 13;
    Everything works fine, the font color too. But the filling of the textbox doesn't work. I always get that Exception:

    System.ArgumentException: Der Wert liegt außerhalb des erwarteten Bereichs.
    Which means in English something like: "The value is out of the expected range"...

    Can you help me?
    Wednesday, June 24, 2009 4:05 PM


  • Oh my goodness. I found a solution. Don't know if this is the usual way, but it works for me fine. I just added:

    shape.Fill.Visible = Microsoft.Office.Core.MsoTriState.msoTrue;

    Sh... - that took me 2 hours of my valuuable development time. This topic can be closed no. Hope this helps sometimes somebody! :)

    Wednesday, June 24, 2009 4:35 PM