情况:
有的时候,你从一个网页里面复制一些文本到你的note里面,会发现很难重新设定这些文本的字体。下面这个macro可以使你设定你notes里面的默认字体
需要注意的是,如果你使用中文,那么你的默认字体需要包含对中文的支持,而像Arial只支持对西文字符的支持,而Arial Unicode MS就包含许多对非西文字符的支持
安装:
- 下载macro
- 打开mind manager
- 选择Tools…Macro…Macros.
- 点击[Add…] 按钮
- 在macro 对话框中,输入如下信息
Name: “Reset Notes Font to Default…”
Path: [下载到本地的macro文件的路径]
Menu: select “Tools”
使用:
- 打开要设定字体的map
- 选择Tools…Reset Notes Font To Default…
- 点击[Yes]继续
下面是macro的具体内容
‘#Reference {F5078F18-C551-11D3-89B9-0000F81FE221}#4.0#0#C:\WINDOWS\system32\msxml4.dll#Microsoft XML, v4.0
‘*******************************************************************************
‘Copyright (c) Mindjet Corporation 2005
‘Decsription: This macro Updates any Notes fonts on a Map to the default Font.
‘Developed by: Vivek Vishist [vivek.vishist@mindjet.com]
‘Date: June 24,2005
‘Modifications(If any):
‘*******************************************************************************
‘*******************************************************************************
Option Explicit
Dim WithEvents myTransaction As Transaction
Sub Main
If VisibleDocuments.Count =0 Then Exit Sub
If MsgBox(“This will revert all fonts in the text notes for current map” + vbCrLf + “back to the default notes font.” + vbCrLf + _
“Would you like to proceed?”, _
vbYesNo,“Reset Notes Fonts”)=vbYes Then
Set myTransaction = ActiveDocument.NewTransaction(“Reset All Notes Fonts”)
myTransaction.Start()
End If
End Sub
Sub TransformTopic(aNotes As Notes ,xslt As MSXML2.FreeThreadedDOMDocument40,xml As MSXML2.FreeThreadedDOMDocument40)
Dim strNotesTextXHTML As String
If aNotes.TextXHTML <> “” Then
‘ Debug.Print(“Processing Topic: ” & aNotes.Text)
‘ Debug.Print (“———————–>>>>>>>> ” & aNotes.TextXHTML )
‘ Debug.Print (“”)
‘ Debug.Print (“”)
Dim result As String
result = Start(xslt,xml)
‘ Debug.Print (“<<<<<<<<<<<<<<<<<<<<———————–” & result )
aNotes.TextXHTML =result
End If
End Sub
Function Start(xslDoc As MSXML2.FreeThreadedDOMDocument40,xmldoc As MSXML2.FreeThreadedDOMDocument40 )As String
On Error GoTo HandleError
Dim result As String
result = xmldoc.transformNode(xslDoc.documentElement)
Start = result
Exit Function
HandleError:
Debug.Print (Err.Description)
End Function
Private Sub myTransaction_Execute( d As Document )
Dim aRange As Range
Set aRange = ActiveDocument.Range(mmRangeAllTopics)
Dim aTopic As Topic
‘Xsl Document
Dim xslDoc As New MSXML2.FreeThreadedDOMDocument40
‘Xml Document
Dim xmldoc As New MSXML2.FreeThreadedDOMDocument40
xmldoc.async = False
xslDoc.async = False
Dim Asa As String
Dim xslString As String
‘Load the XSL
‘xslDoc.Load (“c:\temp\test\ImplementFont.xsl”)
xslString = “<?xml version=’1.0′ encoding=’utf-8′ standalone=’yes’ ?>” & _
“<xsl:stylesheet version=’1.0′ xmlns:xsl=’http://www.w3.org/1999/XSL/Transform’ xmlns=’http://www.w3.org/1999/xhtml’>” & _
“ <xsl:output method=’xml’ encoding=’UTF-8′ />” & _
“ ” & _
“ <xsl:template match=’/'>” & _
“ <xsl:comment>Remove All Fonts</xsl:comment>” & _
“ <xsl:copy>” & _
“ <xsl:apply-templates select=’*|@*|text()’ />” & _
“ </xsl:copy>” & _
“ </xsl:template>” & _
“ <xsl:template match=’node() | @* | text()’>” & _
“ <xsl:copy>” & _
“ <xsl:apply-templates select=’*|@*|text()’ />” & _
“ </xsl:copy>” & _
“ </xsl:template>” & _
“ <xsl:template match=’@face’ />” & _
“ <xsl:template match=’@size’ />” & _
“ <xsl:template match=’@style’/>” & _
“</xsl:stylesheet>
’” <xsl:template match=‘xhtml:font’>“ & _
’” <xsl:apply-templates Select=’*|Text()’ />“ & _
’” </xsl:template>“ & _
’xslDoc.Load (MacroDir & ”\ImplementFont.xsl”)
xslDoc. loadXML(xslString)
For Each aTopic In aRange
xmldoc.validateOnParse = False
xmldoc.loadXML(aTopic.Notes.TextXHTML )
TransformTopic aTopic.Notes ,xslDoc, xmldoc
Next
End Sub
macro
为这篇日志打一下分吧: 








(7 votes, average: 4 out of 5)

