English 中文(简体)
• 如何改变使用c#代码的纸张电池的背景颜色?
原标题:how to change background color of table cell of ppt using c# code?
  • 时间:2012-04-05 19:49:20
  •  标签:
  • c#

我在下面的法典中写道,要改变使用c#代码的平面电池的背景,但是没有发生:

//creating powerpoint aaplication
PowerPoint.Application pptApp = new PowerPoint.Application();
pptApp.Visible = Office.MsoTriState.msoTrue;
var pptPresent = pptApp.Presentations;
var fileOpen = pptPresent.Open(@file, Office.MsoTriState.msoFalse, Office.MsoTriState.msoTrue, Office.MsoTriState.msoTrue);
// getting first slide
PowerPoint.Slide objSlide = fileOpen.Slides[1];
PowerPoint.Shapes item = objSlide.Shapes;
// getting first shape
var shape1 = item[1];
// check if shape is table
if (shape1.HasTable == Office.MsoTriState.msoTrue)
{
    // change the table cell to red color
    shape1.Table.Cell(2, 5).Shape.Fill.BackColor.RGB = System.Drawing.Color.Red.ToArgb();
    // make it visible
    shape1.Fill.Visible = Office.MsoTriState.msoTrue;
}
// saving the ppt
fileOpen.SaveAs(openFolder + subStr + ".pptx",PowerPoint.PpSaveAsFileType.ppSaveAsDefault,Office.MsoTriState.msoTrue);
// close the ppt
fileOpen.Close();

没有人能够帮助我吗?

问题回答

改变囚室彩色 ForeColor需要使用,而不是使用 Back。 肤色可能无法按预期运作。 改变使用科罗拉传输器的情况。

shape1.Table.Cell(2, 5).Shape.Fill.ForeColor.RGB = System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Red);

问题! 锡尔人的财产也可用于沙皮物体,不论它是一个单元还是另一种类型的沙皮。

Another example for the Fill property is mentioned in this thread: https://stackoverflow.com/a/26253177/20337158.

Also from the Microsoft learning sites: https://learn.microsoft.com/en-us/previous-versions/office/office-12/ff763049(v=office.12)





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签