在 powerpoint 中删除 table 边框

Remove table border in powerpoint

代码已成功删除 table 边框并且在屏幕上显示正常。

打印或打印预览时,它显示一些 table 边框。如何解决?

 Sub Tableformatting ()
    Dim r As Long, c As Long
    Dim t As Table
      Set t = ActiveWindow.Selection.ShapeRange.Table
            For r = 1 To t.Rows.Count
            For c = 1 To t.Columns.Count
                With t.Cell(r, c)

                    .Borders(ppBorderTop).Transparency = 0
                    .Borders(ppBorderTop).Weight = 0
                    .Borders(ppBorderBottom).Transparency = 0
                    .Borders(ppBorderBottom).Weight = 0
                    .Borders(ppBorderLeft).Transparency = 0
                    .Borders(ppBorderLeft).Weight = 0

                    .Borders(ppBorderRight).Transparency = 0
                    .Borders(ppBorderRight).Weight = 0

                End With
            Next c
        Next r
    End Sub

尝试使用

Sub Tableformatting()
Dim r As Long, c As Long
Dim t As Table

Set t = ActiveWindow.Selection.ShapeRange.Table

For r = 1 To t.Rows.Count
    For c = 1 To t.Columns.Count
        With t.Cell(r, c)
            .Borders(ppBorderTop).Transparency = 1
            .Borders(ppBorderBottom).Transparency = 1
            .Borders(ppBorderLeft).Transparency = 1
            .Borders(ppBorderRight).Transparency = 1
        End With
    Next c
Next r
End Sub

出于某种原因,.Transparency = 0 仅适用于主动看到的内容,而 .Transparency = 1 适用于您要求的所有内容。这可能是 Microsoft 端的错误,因为我不明白为什么此方法或 .Borders.Visible = msoFalse 不适用于 print/print 预览。

无论如何,我希望这对您有所帮助!