vba - Visio VBA:如何使组织结构图中的所有文本加粗
问题描述
我想简化在 Visio 中更新我的组织结构图。到目前为止,我从这里借用了一个宏https://bvisual.net/2010/01/28/applying-selected-datagraphic-to-the-whole-document/并写在下面。我想对其进行调整以对带有形状的文本格式进行一些更改,例如使字体变粗并可能更改其颜色。我发现很难在网上找到这样的例子,所以任何帮助/建议都将不胜感激。
Public Sub ApplyDataGraphicToDocument()
Dim mstDG As Visio.Master
Dim shp As Visio.Shape
Dim pag As Visio.Page
Dim firstProp As String
If Visio.ActiveWindow.Selection.Count = 0 Then
MsgBox "Please select a shape which already has data graphics"
Exit Sub
Else
Set shp = Visio.ActiveWindow.Selection.PrimaryItem
If shp.DataGraphic Is Nothing Then
MsgBox "Please select a shape which already has data graphics"
Exit Sub
Else
'Get the shapes DataGraphic master
Set mstDG = shp.DataGraphic
'Get the name of the first Shape Data row
firstProp = "Prop." & _
shp.CellsSRC(Visio.visSectionProp, 0, 0).RowNameU
End If
End If
For Each pag In Visio.ActiveDocument.Pages
If pag.Type = visTypeForeground Then
For Each shp In pag.Shapes
'Check that the named Shape Data row exists
If shp.CellExistsU(firstProp, Visio.visExistsAnywhere) Then
'Set the DataGraphic
shp.DataGraphic = mstDG
End If
Next
End If
Next
End Sub
解决方案
您可以修改默认的 OrgChart 形状,尽管它不受官方支持。要更改默认形状(使其字体加粗),您需要编辑这些 OrgChart 形状的模板(母版)。在同一个博客中,您可以在此处找到有关自定义组织结构图的更多信息:https ://bvisual.net/2012/05/08/creating-a-custom-org-chart-template-with-extra-properties
过程大致相同,只是不添加属性,而是将文本加粗。
推荐阅读
- email - 如何加密消息node.js sendmail?
- svg - circle 和 stroke-dasharray 的跨浏览器 SVG 渲染问题
- php - 推进 ORM v1.6 中的 UNION 查询
- python - 如何在 RNN 中正确使用 Dropout
- node.js - 如何使用 Python3 将 .wav 文件流式传输到 websocket(我有一个工作节点示例)
- python - 从 python3 在两个不同的终端中启动两个 shell sudo 脚本
- javascript - 如何在 div 内水平内联按钮?
- unit-testing - 如何查看测试和断言的数量
- jquery - 对 ASP.Net MVC 验证进行故障排除?电子邮件验证电话不
- java - 来自单应性opencv的旋转和平移矩阵