Added fonts to styles conversion
This commit is contained in:
parent
e9caf166d1
commit
d5ba33005f
3 changed files with 29 additions and 1 deletions
|
@ -11,6 +11,8 @@
|
|||
saveDocument
|
||||
doNotTrack
|
||||
statusIndicator.Start("Чистка документа начата, подождите",30)
|
||||
|
||||
convertFontsToCharStyles
|
||||
cleanFormatting
|
||||
disposeAllLinks
|
||||
disposeAllBookmarks
|
||||
|
@ -22,6 +24,32 @@
|
|||
saveAndreload()
|
||||
End Sub
|
||||
|
||||
|
||||
'Replaces manual formatting text with font into character style with assigned font
|
||||
Private Sub convertFontsToCharStyles
|
||||
Dim oDoc
|
||||
oDoc = Thiscomponent
|
||||
Dim srch(0) as new com.sun.star.beans.PropertyValue
|
||||
SDesc = Thiscomponent.createSearchDescriptor()
|
||||
SDesc.SearchAll = true
|
||||
SDesc.ValueSearch = false
|
||||
SDesc.SearchStyles = false
|
||||
SDesc.SearchRegularExpression = false
|
||||
SDesc.SearchString = ""
|
||||
srch(0).Name = "CharFontName"
|
||||
SDesc.SetSearchAttributes(srch())
|
||||
founds = Thiscomponent.findFirst(SDesc)
|
||||
do while not isNull(founds)
|
||||
curFont = founds.CharFontName
|
||||
If Not DocHasCharStyle(oDoc,curFont) Then
|
||||
oProps() = Array(CreateProperty("CharFontName", curFont))
|
||||
CreateCharacterStyle(curFont, oProps())
|
||||
End If
|
||||
founds.CharStyleNames = Array(curFont)
|
||||
founds = Thiscomponent.findNext(founds.getend, SDesc)
|
||||
loop
|
||||
End Sub
|
||||
|
||||
Private Sub fixFrequentMistakes
|
||||
Dim NBSP As String
|
||||
Dim space As String
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue