无法在表格单元格中显示文本的“文本轮廓”
var sel = Globals.ThisAddIn.Application.ActiveWindow.Selection;
sel.TextRange2.Font.Line.Visible = MsoTriState.msoTrue;
sel.TextRange2.Font.Line.Transparency = 1;
上面的代码使形状中的文本抗锯齿。表格的单元格中的文本将不起作用。我在下面尝试过,仅使文本加粗。似乎Font(实际上是Font2)对象是只读的,但是我可以在Powerpoint上手动执行相同操作
private void Button1_Click_1(object sender, RibbonControlEventArgs e)
{
var sel = Globals.ThisAddIn.Application.ActiveWindow.Selection;
try
{
var tab = Globals.ThisAddIn.Application.ActiveWindow.Selection.ShapeRange.Table;
int col = sel.ShapeRange.Table.Columns.Count;
int row = sel.ShapeRange.Table.Rows.Count;
for (int i = 1; i <= row; i++)
{
for (int j = 1; j <= col; j++)
{
tab.Cell(i, j).Shape.TextFrame2.TextRange.Font.Bold = MsoTriState.msoTrue;
tab.Cell(i, j).Shape.TextFrame2.TextRange.Font.Line.Visible = MsoTriState.msoTrue;
tab.Cell(i, j).Shape.TextFrame2.TextRange.Font.Line.Transparency = 1;
}
}
}
catch
{
}
}