VB.NETÉćéOpenOffice
Automation
VcdqvZ@ŽďĐ
OpenOfficeÍ˝ĚlXĚsÍÉćč쏳ę˝t[\tgEFAšB
žĐɨ˘ÄŕťĚęđSˇ× OpenOffice.org
Calc,Writer,Baseđ
MicrosoftĐVB.NETÉÄAutomationťľÜľ˝B
JÉtŤÜľÄ͢EĚ˝ĚűXɲŚÍđ¸ŤÜľ˝B
¨çƤɺLÉÄťĚR[hĚęđĐîľÜˇB
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Mppyp@Kwy}p
Ú
1.ÂŤ
2.QĆdll
3-1.nNCalc
3-2.nNCalcDoc
3-3.nNCalcSheet
3-4.nNCalcRange
4-1.nNWriter
4-2.nNWriterDoc
5-1.nNBase
5-2.nNBaseRowSet
8-1.nNOOGraphic
8-2.nNOOPrinter
8-5.NOO
9-1.NOffice
1.ÂŤ
ApacheOpenOffice 4.1.0ĹěŹ
4.1.0ÍUNCwčĚstartÍsÂ(ex \\xxxx\c\xxxx.ods)
ąĚ×AŘÓ°ÄNŽÍÄŢײĚŢNŽ(x:\xxxx.ods)ÉϡĚKvŞ éB
VisualStudio2010
FrameWork2.0
2.QĆdll
cli_basetypes
cli_cppuhelper
cli_oootypes
cli_uno
cli_uretypes
ŽAOpenOfficeĚImportsÍJnŹxĚáşĚ×sĚpƾܾ˝B
R[hĹźÚwčľÄ˘ÜˇB
3-1.nNCalc
Imports System.ComponentModel
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
''' <summary>
''' Open Office Calc
''' </summary>
Public Class nNCalc
Public
g_xcc As
unoidl.com.sun.star.uno.XComponentContext
Public
g_xmsf As
unoidl.com.sun.star.lang.XMultiServiceFactory
Public
g_xdesktop As
unoidl.com.sun.star.frame.XDesktop
Public
g_xdh As
unoidl.com.sun.star.frame.XDispatchHelper = Nothing
Public
Sub New _
( _
)
Try
If NOffice.nfIsOpenOfficeInstalled = False Then
NError.nfRaise("", "Calc is not installed")
End If
g_xcc = uno.util.Bootstrap.bootstrap
g_xmsf = g_xcc.getServiceManager
g_xdesktop =
g_xmsf.createInstance("com.sun.star.frame.Desktop")
g_xdh =
g_xmsf.createInstance("com.sun.star.frame.DispatchHelper")
Catch ex As Exception
NError.nfShow(ex, Err.Number)
End Try
End Sub
''' <summary>
''' Doc
create
''' </summary>
''' <param name="strDocFile">DocFile</param>
''' <param name="blnHidden">true=Hidden</param>
''' <param name="blnActionLock">true=ActionLock</param>
Public
Function nfDocCreate _
(Optional ByVal
strDocFile As String
= "" _
, Optional ByVal
blnHidden As Boolean
= True _
, Optional ByVal
blnActionLock As Boolean
= True _
) As nNCalcDoc
Try
Dim npv As
New nNOOPropertyValue
If blnHidden = True
Then
npv.nfAdd("Hidden", True)
End If
''without re-set Bridge is broken in nfDisplay
'g_xcc = uno.util.Bootstrap.bootstrap
'g_xmsf = g_xcc.getServiceManager
'g_xdesktop =
g_xmsf.createInstance("com.sun.star.frame.Desktop")
Dim xcl As
unoidl.com.sun.star.frame.XComponentLoader = g_xdesktop
'Dim xc As unoidl.com.sun.star.lang.XComponent
= xcl
'xc.addEventListener()
Dim doc As
unoidl.com.sun.star.sheet.XSpreadsheetDocument = _
xcl.loadComponentFromURL("private:factory/scalc" _
, "_blank" _
, 0 _
, npv._PropertyValues _
)
Dim ndoc As
New nNCalcDoc(Me,
doc, strDocFile, True)
If blnActionLock = True Then
ndoc.nfActionLock(True)
End If
'NOO.nfPropertyDisplay(ndoc._doc)
''service of Doc
'Dim xmsf As XMultiServiceFactory = doc
'Dim strs() As String =
xmsf.getAvailableServiceNames
'NMsgBox.nfShow(strs)
ndoc._strDocFontName = NConst.strFontFamilyMSşŢźŻ¸
'null effect(set of Config?)
ndoc._objProperty(NOO.enmCalcDocPpt.SpellOnline) = False
'NOO.nfPropertyDisplay(doc)
'default is standard style vertjustify=bottom
ndoc._enmVertJustify = NOO.enmCellVertJustify.CENTER
ndoc._blnShowGrid = False
Return ndoc
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' Doc
open
''' </summary>
''' <param name="strDocFile">DocFile</param>
''' <param name="strPassword">Password</param>
''' <param name="blnHidden">true=Hidden</param>
''' <param name="blnActionLock">true=ActionLock</param>
Public
Function nfDocOpen _
(ByVal strDocFile As String _
, Optional ByVal
strPassword As String
= "" _
, Optional ByVal
blnHidden As Boolean
= True _
, Optional ByVal
blnActionLock As Boolean
= True _
) As nNCalcDoc
Try
If NIO.nfFileExists(strDocFile) <>
"" Then
NError.nfRaise(strDocFile, "strDocFile error")
End If
Dim npv As
New nNOOPropertyValue
If blnHidden = True
Then
npv.nfAdd("Hidden", True)
End If
If
strPassword <> "" Then
npv.nfAdd("Password", strPassword)
End If
'without get agin in nfDisplay Bridge is
broken
'g_xcc = uno.util.Bootstrap.bootstrap
'g_xmsf = g_xcc.getServiceManager
'g_xdesktop =
g_xmsf.createInstance("com.sun.star.frame.Desktop")
Dim xcl As
unoidl.com.sun.star.frame.XComponentLoader = g_xdesktop
Dim doc As
unoidl.com.sun.star.sheet.XSpreadsheetDocument = _
xcl.loadComponentFromURL(NIO.nfFilePathToFileURL(strDocFile) _
, "_blank" _
, 0 _
, npv._PropertyValues _
)
If doc Is
Nothing Then
NError.nfRaise(strDocFile, "OpenDoc error")
End If
Dim ndoc As
New nNCalcDoc(Me,
doc, strDocFile, False)
If blnActionLock = True Then
ndoc.nfActionLock(True)
End If
ndoc._objProperty(NOO.enmCalcDocPpt.SpellOnline) = False
Return ndoc
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
CloseDoc
''' </summary>
''' <param name="ndoc">nNOOCalcDoc</param>
Public
Function nfDocClose _
(ByVal ndoc As
nNCalcDoc _
) As Boolean
Try
'ndoc.nfActionLock(False)
Dim xcla As
unoidl.com.sun.star.util.XCloseable = ndoc._doc
xcla.close(True)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Version 3.2.1-->3.2
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_strVersion() As String
Get
'in OOo3.4 not use
'g_xcc = uno.util.Bootstrap.bootstrap
'g_xmsf = g_xcc.getServiceManager
Dim xcp As
unoidl.com.sun.star.lang.XMultiServiceFactory = _
g_xmsf.createInstance("com.sun.star.configuration.ConfigurationProvider")
Dim params(0) As
uno.Any
params(0) = New uno.Any(GetType(unoidl.com.sun.star.beans.PropertyValue) _
, New
unoidl.com.sun.star.beans.PropertyValue("nodepath" _
,
0 _
, New
uno.Any("/org.openoffice.Setup/Product") _
, unoidl.com.sun.star.beans.PropertyState.DEFAULT_VALUE _
)
_
)
Dim xna As
unoidl.com.sun.star.container.XNameAccess = _
xcp.createInstanceWithArguments _
("com.sun.star.configuration.ConfigurationAccess", params)
Return
xna.getByName("ooSetupVersion").Value.ToString
End Get
End
Property
End Class
3-2.nNCalcDoc
Imports System.Windows.Forms
Imports System.ComponentModel
Imports System.Drawing
Imports System.Text
'Imports uno.util
'Imports unoidl.com.sun.star.frame
'XSelectionSupplier
'Imports unoidl.com.sun.star.lang
'XMultiServiceFactory
'Imports unoidl.com.sun.star.sheet
'XSpreadSheetDocument
'Imports unoidl.com.sun.star.table
'XCellRangeAddress
'Imports unoidl.com.sun.star.uno
'Imports unoidl.com.sun.star.beans 'PropertyValue
'Imports unoidl.com.sun.star.util
'xeventssupplier
'Imports unoidl.com.sun.star.container 'XNamed
'Imports unoidl.com.sun.star.document 'XActionLockable
'Imports unoidl.com.sun.star.style
'XStyleFamilySupplier
'Imports unoidl.com.sun.star.script
'XLibraryContainer2
'Imports unoidl.com.sun.star.text
'XText
'Imports unoidl.com.sun.star.view
'XSelectionSupplier
'Imports unoidl.com.sun.star.graphic
''' <summary>
''' control Calc Document
''' </summary>
Public Class nNCalcDoc
Public
g_ncalc As nNCalc = Nothing
Private
g_doc As
unoidl.com.sun.star.sheet.XSpreadsheetDocument
Private
g_strDocFile As String
Private
g_blnCreate As Boolean
Private
g_strPassword As String
Private
g_pntMaxColumnAndRow As Point = Nothing '1-
Public
Sub New _
(ByVal ncalc As nNCalc
_
, ByVal doc As
unoidl.com.sun.star.sheet.XSpreadsheetDocument _
, ByVal strDocFile As String _
, ByVal blnCreate As Boolean _
)
Try
g_ncalc = ncalc
g_doc = doc
g_strDocFile = strDocFile
g_blnCreate = blnCreate
'change to only 1 Sheet
If blnCreate = True
Then
For p1 As
Integer = g_doc.getSheets.getElementNames.Length
- 1 To 1 Step
-1
nfRemoveSheet(p1)
Next
Dim nsheet As
nNCalcSheet = nfGetSheet("Sheet1")
nsheet._strName = "__NDummy"
End If
'Max column & row
Dim sheets As
unoidl.com.sun.star.sheet.XSpreadsheets = g_doc.getSheets
Dim strSheetNames() As String =
sheets.getElementNames()
Dim sheet As
unoidl.com.sun.star.sheet.XSpreadsheet = _
sheets.getByName(strSheetNames(0)).Value
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = sheet
g_pntMaxColumnAndRow = New
Point(xcrr.getColumns.getCount _
, xcrr.getRows.getCount _
)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
End Try
End
Sub
''' <summary>add Sheet
'''
[return]String error message
''' </summary>
''' <param name="strSheetName">SheetName</param>
''' <param name="chrOverlap">e=error i=ignore r=replace</param>
''' <param name="objTemplateDoc">TemplateDocFile(string) or nNOOCalcDoc nothing=me</param>
''' <param name="strTemplateSheetName">TemplateSheetName</param>
''' <param name="strBeforeSheetName">ref WorkSheet.Copy</param>
''' <param name="strAfterSheetName">ref WorkSheet.Copy</param>
Public
Function nfInsertSheet _
(Optional ByVal
strSheetName As String
= "Sheet1" _
, Optional ByVal
chrOverlap As Char
= "e"c _
, Optional ByVal
objTemplateDoc As Object
= Nothing _
, Optional ByVal
strTemplateSheetName As String = "" _
, Optional ByVal
strBeforeSheetName As String
= "" _
, Optional ByVal
strAfterSheetName As String
= "" _
) As nNCalcSheet
Try
If strSheetName = "" Then
NError.nfRaise("", "strSheetName=null")
End If
Dim nsheet As
nNCalcSheet = nfGetSheet(strSheetName)
If nsheet IsNot
Nothing Then
If chrOverlap = "e"c Then
NError.nfRaise(strSheetName, "strSheetName Overlaped")
ElseIf chrOverlap = "i"c Then
Return nsheet
'replace
Else
nfRemoveSheet(nsheet._strName)
End If
End If
''''''''' newsheet
If (objTemplateDoc Is Nothing OrElse _
(objTemplateDoc.GetType Is GetType(String) AndAlso objTemplateDoc = "")) AndAlso _
strTemplateSheetName = "" Then
Dim int1 As
Integer = nfInsertSpaceSheet(strSheetName _
,
strBeforeSheetName _
, strAfterSheetName _
)
nsheet = New nNCalcSheet(Me, fGetSheet(int1))
''''''''''copy from Template
Else
If strTemplateSheetName = "" Then
strTemplateSheetName = "Sheet1"
End If
nfSheetCopy(strSheetName _
, strTemplateSheetName _
,
objTemplateDoc _
, _
, strBeforeSheetName _
, strAfterSheetName _
)
nsheet = New nNCalcSheet(Me, fGetSheet(strSheetName))
End If
nsheet._strPageHeader("l"c)
= ""
nsheet._strPageHeader("c"c) = ""
'_Header() = "Page:&p/&c
Dtae:&d &t &n"
nsheet._strPageHeader() = ""
nsheet._strPageFooter("l"c) = ""
nsheet._strPageFooter("c"c) = ""
nsheet._strPageFooter("r"c)
= ""
Return nsheet
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
SheetCopy
''' </summary>
''' <param name="strToSheetName">SheetName to copy</param>
''' <param name="strFromSheetName">SheetName from copy</param>
''' <param name="objFromDoc">DocName(string) or nNOOCalcDoc </param>
''' <param name="strFromDocPassword">DocPassword</param>
''' <param name="strBeforeSheetName">BeforeSheetName</param>
''' <param name="strAfterSheetName">AfterSheetName</param>
Public
Function nfSheetCopy _
(ByVal strToSheetName As
String _
, ByVal strFromSheetName As
String _
, Optional ByVal
objFromDoc As Object
= Nothing _
, Optional ByVal
strFromDocPassword As String
= "" _
, Optional ByVal
strBeforeSheetName As String
= "" _
, Optional ByVal
strAfterSheetName As String
= "" _
) As Boolean
Try
If strToSheetName = "" Then
NError.nfRaise("", "strToSheetName=null error")
End If
If strFromSheetName = "" Then
NError.nfRaise("", "strToSheetName=null error")
End If
Dim clsClipboardDatas() As NClipboard.g_ctypClipboardData = _
NClipboard.nfSaveClipboardData()
Dim ndocFrom As
nNCalcDoc = Nothing
Dim nsheetFrom As
nNCalcSheet = Nothing
Dim nsheetTo As
nNCalcSheet = Nothing
If objFromDoc IsNot
Nothing Then
If objFromDoc.GetType Is GetType(String) Then
ndocFrom = g_ncalc.nfDocOpen(NIO.nfGetFullPath(objFromDoc) _
, strFromDocPassword _
)
Else
ndocFrom =
objFromDoc
End If
nsheetFrom = ndocFrom.nfGetSheet(strFromSheetName)
If nsheetFrom Is
Nothing Then
If objFromDoc.GetType Is GetType(String) Then
ndocFrom.nfClose()
End If
NError.nfRaise(strFromSheetName, "strFromSheetName error")
End If
nsheetFrom.nfActivate()
ndocFrom.nfDispatch("SelectAll")
ndocFrom.nfDispatch("Copy")
'UserMacro copy
nfMacroCopy(ndocFrom)
nfEventsCopy(ndocFrom)
nfStyleCopy(ndocFrom)
_blnShowColumnRowHeader = ndocFrom._blnShowColumnRowHeader
_blnShowGrid = ndocFrom._blnShowGrid
Else
nsheetFrom = nfGetSheet(strFromSheetName)
If nsheetFrom Is
Nothing Then
NError.nfRaise(strFromSheetName, "strFromSheetName error")
End If
nfSheetActivate(strFromSheetName)
nfDispatch("SelectAll")
nfDispatch("Copy")
End If
'insert space sheetinsert
Dim intx As
Integer = _
nfInsertSpaceSheet(strToSheetName _
, strBeforeSheetName _
, strAfterSheetName _
)
nsheetTo = New nNCalcSheet(Me, fGetSheet(intx))
nfSheetActivate(nsheetTo._strName)
nfDispatch("Paste")
'PageStyle copy
nsheetTo._strPageStyle = nsheetFrom._strPageStyle
'FreezePane copy
nsheetTo._pntFreezePane = nsheetFrom._pntFreezePane
'PageBreak copy
nsheetTo._intPageBreaks = nsheetFrom._intPageBreaks
'NamedRange
If objFromDoc IsNot
Nothing Then
nfNamedRangeCopy(ndocFrom _
, strFromSheetName _
, strToSheetName _
)
End If
If ndocFrom IsNot
Nothing AndAlso
_
objFromDoc.GetType Is GetType(String) Then
ndocFrom.nfClose()
End If
NClipboard.nfRestoreClipboardData(clsClipboardDatas)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' get
Sheet
''' </summary>
''' <param name="objName">string name or index(1-)</param>
Public
Function nfGetSheet _
(ByVal objName As Object _
) As nNCalcSheet
Try
Dim sheet As
unoidl.com.sun.star.sheet.XSpreadsheet = fGetSheet(objName)
If sheet Is
Nothing Then
Return Nothing
Else
Dim nsheet As
nNCalcSheet = New nNCalcSheet(Me, sheet)
Return nsheet
End If
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' get
SheetNames
''' </summary>
Public
Function nfGetSheetNames _
( _
) As String()
Try
Dim lst As
New List(Of String)
lst.AddRange(g_doc.getSheets.getElementNames)
For p1 As
Integer = 0 To
lst.Count - 1
If lst(p1) = "__NDummy" Then
lst.RemoveAt(p1)
Exit For
End If
Next
Return lst.ToArray
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
Private
Function fGetSheet _
(ByVal objName As Object _
) As unoidl.com.sun.star.sheet.XSpreadsheet
Try
Dim strSheetNames() As String =
nfGetSheetNames()
If objName.GetType Is GetType(String) Then
For p1 As
Integer = 0 To
strSheetNames.Length - 1
If NStr.nfCompare(strSheetNames(p1),
objName) = 0 Then
Return
g_doc.getSheets.getByName(strSheetNames(p1)).Value
End If
Next
Else
Dim intx As
Integer = objName
If intx >= 1 AndAlso
_
intx <= strSheetNames.Length Then
Return g_doc.getSheets.getByName(strSheetNames(intx -
1)).Value
End If
End If
Return Nothing
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
remove Sheet
''' </summary>
''' <param name="objName">string name or index</param>
Public
Function nfRemoveSheet _
(ByVal objName As Object _
) As Boolean
Try
Dim sheets As
unoidl.com.sun.star.sheet.XSpreadsheets = g_doc.getSheets
Dim strSheetNames() As String =
sheets.getElementNames
If objName.GetType Is GetType(String) Then
If sheets.hasByName(objName) Then
sheets.removeByName(objName)
Return
True
End If
Else
Dim px As
Integer = objName
If px >= 0 AndAlso
_
px <= strSheetNames.Length - 1 Then
sheets.removeByName(strSheetNames(px))
Return True
End If
End If
Return False
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
InsertSpaceSheet
'''
[return]Sheet intIndex (1-)
''' </summary>
''' <param name="strSheetName">SheetName</param>
''' <param name="strBeforeSheetName">BeforeSheetName</param>
''' <param name="strAfterSheetName">AfterSheetName</param>
Public
Function nfInsertSpaceSheet _
(ByVal strSheetName As
String _
, Optional ByVal
strBeforeSheetName As String
= "" _
, Optional ByVal
strAfterSheetName As String
= "" _
) As Integer
Try
Dim strError As
String =
NOffice.nfCheckSheetNameIntegrity(strSheetName)
If strError <> "" Then
NError.nfRaise(strError, "strSheetName error")
End If
Dim sheets As
unoidl.com.sun.star.sheet.XSpreadsheets = g_doc.getSheets
Dim strSheetNames() As String =
sheets.getElementNames
If sheets.hasByName(strSheetName) = True Then
strSheetName = nfGetUniqueSheetName(strSheetName)
End If
If strBeforeSheetName <>
"" Then
If sheets.hasByName(strBeforeSheetName)
= False Then
NError.nfRaise(strBeforeSheetName, "strBeforeSheetName error")
End If
For p1 As
Integer = 0 To
strSheetNames.Length - 1
If NStr.nfCompare(strBeforeSheetName,
strSheetNames(p1)) = 0 Then
Dim px As
Integer = p1
sheets.insertNewByName(strSheetName,
px)
For p2 As
Integer = 0 To
px
If strSheetNames(p2) =
"__NDummy" Then
px -= 1
Exit For
End If
Next
Return px + 1
End If
Next
End If
If strAfterSheetName <>
"" Then
If sheets.hasByName(strAfterSheetName) =
False Then
NError.nfRaise(strAfterSheetName, "strAfterSheetName error")
End If
For p1 As
Integer = 0 To
strSheetNames.Length - 1
If NStr.nfCompare(strAfterSheetName,
strSheetNames(p1)) = 0 Then
Dim px As
Integer = p1 + 1
sheets.insertNewByName(strSheetName, px)
For p2 As
Integer = 0 To
px - 1
If strSheetNames(p2) =
"__NDummy" Then
px -= 1
Exit For
End If
Next
Return px + 1
End If
Next
End If
sheets.insertNewByName(strSheetName, strSheetNames.Length)
strSheetNames = sheets.getElementNames
Dim intIndex As
Integer = strSheetNames.Length
For p1 As
Integer = 0 To
strSheetNames.Length - 1
If strSheetNames(p1) =
"__NDummy" Then
intIndex -= 1
Exit For
End If
Next
Return intIndex
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' get
UniqueSheetName
''' </summary>
''' <param name="strSheetName">SheetName</param>
Public
Function nfGetUniqueSheetName _
(ByVal strSheetName As
String _
) As String
Try
If strSheetName = "" Then
NError.nfRaise("", "strSheetName=null error")
End If
Dim sheets As
unoidl.com.sun.star.sheet.XSpreadsheets = g_doc.getSheets
If sheets.hasByName(strSheetName) = True Then
Dim sheet As
unoidl.com.sun.star.sheet.XSpreadsheet = _
sheets.getByName(strSheetName).Value
Dim named As
unoidl.com.sun.star.container.XNamed = sheet
Dim strSheetNames() As String = sheets.getElementNames
Dim intLastNO As
Integer = 1
strSheetName = named.getName & "_"
For p1 As
Integer = 0 To
strSheetNames.Length - 1
Dim int1 As
Integer = NStr.nfLeft(strSheetNames(p1),
strSheetName)
If int1 <> 0 Then
intLastNO = NSS.nfCInt(Mid(strSheetNames(p1), int1 + 1))
End If
Next
strSheetName &= intLastNO + 1
End If
Return strSheetName
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
SheetActivate
''' </summary>
''' <param name="objSheetName">Activate SheetName</param>
Public Function nfSheetActivate _
(ByVal objSheetName As
Object _
) As nNCalcSheet
Try
If objSheetName Is
Nothing OrElse
_
(objSheetName.GetType Is GetType(String) AndAlso objSheetName = "") OrElse _
(objSheetName.GetType IsNot GetType(String) AndAlso objSheetName = 0) Then
NError.nfRaise("", "objSheetName=null error")
End If
Dim xsv As
unoidl.com.sun.star.sheet.XSpreadsheetView = _CurrentController
Dim sheet As
unoidl.com.sun.star.sheet.XSpreadsheet = fGetSheet(objSheetName)
xsv.setActiveSheet(sheet)
Return New
nNCalcSheet(Me, sheet)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' copy
all sheet from another book(use in OLE)
''' </summary>
''' <param name="strFromDocFile">DocName</param>
''' <param name="strFromDocPassword">DocPassword</param>
Public
Function nfAllSheetCopy _
(Optional ByVal
strFromDocFile As String
= "" _
, Optional ByVal
strFromDocPassword As String
= "" _
) As Boolean
Try
If NIO.nfFileExists(strFromDocFile)
<> "" Then
NError.nfRaise(strFromDocFile, "strFromDocFile error")
End If
Dim strSheetNames() As String =
nfGetSheetNames()
'rename NO1Sheet to __NDummy
Dim bln As
Boolean = False
For p1 As
Integer = 0 To
strSheetNames.Length - 1
If strSheetNames(p1) =
"__NDummy" Then
bln
= True
Exit For
End If
Next
If bln = False
Then
For p1 As
Integer = 0 To
strSheetNames.Length - 1
If p1 = 0 Then
Dim nsheet As
nNCalcSheet = nfGetSheet(strSheetNames(p1))
nsheet._strName = "__NDummy"
Else
nfRemoveSheet(strSheetNames(p1))
Exit For
End If
Next
Else
For p1 As
Integer = 0 To
strSheetNames.Length - 1
If strSheetNames(p1) <>
"__NDummy" Then
nfRemoveSheet(strSheetNames(p1))
Exit For
End If
Next
End If
nfRemoveNamedRange()
nfRemoveMacro()
nfRemoveEvents()
nfRemoveStyle("", True)
nfRemoveStyle("", False)
Dim clsClipboardDatas() As NClipboard.g_ctypClipboardData = _
NClipboard.nfSaveClipboardData
Dim ndocFrom As
nNCalcDoc = _
g_ncalc.nfDocOpen(NIO.nfGetFullPath(strFromDocFile) _
, strFromDocPassword _
)
Dim strSheetNamesFrom() As String =
ndocFrom.nfGetSheetNames()
For p1 As
Integer = 0 To
strSheetNamesFrom.Length - 1
If strSheetNamesFrom(p1) <>
"__NDummy" Then
'insert space sheet
Dim intx As
Integer =
nfInsertSpaceSheet(strSheetNamesFrom(p1))
Dim nsheetTo As
nNCalcSheet = New nNCalcSheet(Me, fGetSheet(intx))
Dim xsl As
unoidl.com.sun.star.sheet.XSheetLinkable = nsheetTo._sheet
xsl.link(NIO.nfFilePathToFileURL(NIO.nfGetFullPath(strFromDocFile)) _
, strSheetNamesFrom(p1) _
,
"" _
, "" _
, unoidl.com.sun.star.sheet.SheetLinkMode.NORMAL _
)
xsl.setLinkMode(unoidl.com.sun.star.sheet.SheetLinkMode.NONE)
Dim nsheetFrom As
nNCalcSheet = _
ndocFrom.nfGetSheet(strSheetNamesFrom(p1))
'PageStyle copy
nsheetTo._strPageStyle = nsheetFrom._strPageStyle
'FreezePane copy
nsheetTo._pntFreezePane = nsheetFrom._pntFreezePane
'PageBreak copy
nsheetTo._intPageBreaks = nsheetFrom._intPageBreaks
'NamedRange
nfNamedRangeCopy(ndocFrom _
, strSheetNamesFrom(p1) _
, strSheetNamesFrom(p1) _
)
End If
Next
'UserMacro copy
nfMacroCopy(ndocFrom)
nfEventsCopy(ndocFrom)
nfStyleCopy(ndocFrom)
_blnShowColumnRowHeader = ndocFrom._blnShowColumnRowHeader
_blnShowGrid = ndocFrom._blnShowGrid
ndocFrom.nfClose()
nfRemoveSheet("__NDummy")
NClipboard.nfRestoreClipboardData(clsClipboardDatas)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Select
''' </summary>
''' <param name="obj">ex)XCellRange</param>
Public
Function nfSelect _
(ByVal obj As Object _
) As Boolean
Try
Dim xss As
unoidl.com.sun.star.view.XSelectionSupplier = _CurrentController
xss.select(New uno.Any(obj.GetType,
obj))
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' copy
NamedRange from another sheet
''' at
overlap, add _SheetName
''' </summary>
''' <param name="ndocFrom">nNOOCalcDoc</param>
''' <param name="strFromSheetName">from SheetName</param>
''' <param name="strToSheetName">To SheetName</param>
Public
Function nfNamedRangeCopy _
(ByVal ndocFrom As
nNCalcDoc _
, ByVal strFromSheetName As
String _
, ByVal strToSheetName As
String _
) As Boolean
Try
Dim nsheetFrom As
nNCalcSheet = ndocFrom.nfGetSheet(strFromSheetName)
Dim strRangeNamesFrom() As String =
nsheetFrom.nfGetRangeNames
'Dim nsheetTo As nNCalcSheet =
nfGetSheet(strToSheetName)
'get all NamedRanges of doc
Dim xnrsTo As
unoidl.com.sun.star.sheet.XNamedRanges = _
_objProperty(NOO.enmCalcDocPpt.NamedRanges)
Dim strRangeNamesTo() As String =
xnrsTo.getElementNames
For p1 As
Integer = 0 To
strRangeNamesFrom.Length - 1
Dim strRangeName As String = strRangeNamesFrom(p1)
'check overlap
'20120402
Dim blnOverlap As
Boolean = False
For p2 As
Integer = 0 To
strRangeNamesTo.Length - 1
If NStr.nfCompare(strRangeNamesTo(p2),
strRangeName) = 0 Then
blnOverlap = True
Exit For
End If
Next
Dim nrng As
nNCalcRange = nsheetFrom.nfGetRange(strRangeName)
Dim strAbsoluteName As String = _
"$" & strToSheetName & Mid(nrng._strAbsoluteName _
, nrng._strAbsoluteName.IndexOf("."c) + 1 _
)
Dim ca As
New unoidl.com.sun.star.table.CellAddress
'20120402
If blnOverlap = True
Then
strRangeName &= "_" & strToSheetName
End If
'same name of another sheet is error
xnrsTo.addNewByName(strRangeName _
, strAbsoluteName _
, ca _
, 0 _
)
Next
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
remove NamedRange
''' </summary>
''' <param name="strSheetName">SheetName null=all sheet</param>
Public
Function nfRemoveNamedRange _
(Optional ByVal
strSheetName As String
= "" _
) As Boolean
Try
'get all NamedRange
Dim nsheet As
nNCalcSheet = Nothing
If strSheetName <> "" Then
nsheet = nfGetSheet(strSheetName)
End If
Dim xnrs As
unoidl.com.sun.star.sheet.XNamedRanges = _
_objProperty(NOO.enmCalcDocPpt.NamedRanges)
Dim strRangeNames() As String =
xnrs.getElementNames
For p1 As
Integer = 0 To
strRangeNames.Length - 1
If nsheet IsNot
Nothing Then
Dim xrng As
unoidl.com.sun.star.table.XCellRange = _
nsheet._sheet.getCellRangeByName(strRangeNames(p1))
If xrng IsNot
Nothing Then
End If
Else
xnrs.removeByName(strRangeNames(p1))
End If
Next
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' copy
Maco from another doc
''' </summary>
''' <param name="ndocFrom">nNOOCalcDoc</param>
Public
Function nfMacroCopy _
(ByVal ndocFrom As
nNCalcDoc _
) As Boolean
Try
Dim xlcFrom As
unoidl.com.sun.star.script.XLibraryContainer2 = _
ndocFrom._objProperty(NOO.enmCalcDocPpt.BasicLibraries)
If xlcFrom.hasElements Then
Dim strLibrariesFrom() As String =
xlcFrom.getElementNames
Dim xlcTo As
unoidl.com.sun.star.script.XLibraryContainer2 = _
_objProperty(NOO.enmCalcDocPpt.BasicLibraries)
For p1 As
Integer = 0 To
strLibrariesFrom.Length - 1
Dim strLibName As
String = strLibrariesFrom(p1)
If xlcTo.hasByName(strLibName) = False Then
If xlcFrom.isLibraryLoaded(strLibName) =
False Then
xlcFrom.loadLibrary(strLibName)
End If
xlcTo.createLibrary(strLibName)
Dim xncFrom As
unoidl.com.sun.star.container.XNameContainer = _
xlcFrom.getByName(strLibName).Value
Dim xncTo As
unoidl.com.sun.star.container.XNameContainer = _
xlcTo.getByName(strLibName).Value
If xncFrom.hasElements Then
Dim strModuleNames() As String =
xncFrom.getElementNames
For p2 As
Integer = 0 To
strModuleNames.Length - 1
Dim any As
uno.Any = _
xncFrom.getByName(strModuleNames(p2))
xncTo.insertByName(strModuleNames(p2),
any)
Next
End If
End If
Next
End If
'Dialog Libraries
xlcFrom = ndocFrom._objProperty(NOO.enmCalcDocPpt.DialogLibraries)
If xlcFrom.hasElements Then
Dim strLibrariesFrom() As String =
xlcFrom.getElementNames
Dim xlcTo As
unoidl.com.sun.star.script.XLibraryContainer2 = _
_objProperty(NOO.enmCalcDocPpt.DialogLibraries)
For p1 As Integer = 0 To
strLibrariesFrom.Length - 1
Dim strLibName As
String = strLibrariesFrom(p1)
If xlcTo.hasByName(strLibName) = False Then
If xlcFrom.isLibraryLoaded(strLibName) =
False Then
xlcFrom.loadLibrary(strLibName)
End If
xlcTo.createLibrary(strLibName)
Dim xncFrom As
unoidl.com.sun.star.container.XNameContainer = _
xlcFrom.getByName(strLibName).Value
Dim xncTo As
unoidl.com.sun.star.container.XNameContainer = _
xlcTo.getByName(strLibName).Value
If xncFrom.hasElements Then
Dim strModuleNames() As String =
xncFrom.getElementNames
For p2 As
Integer = 0 To
strModuleNames.Length - 1
Dim any As
uno.Any = _
xncFrom.getByName(strModuleNames(p2))
xncTo.insertByName(strModuleNames(p2), any)
Next
End If
End If
Next
End If
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
remove Maco
''' </summary>
Public
Function nfRemoveMacro _
( _
) As Boolean
Try
Dim xlc As
unoidl.com.sun.star.script.XLibraryContainer2 = _
_objProperty(NOO.enmCalcDocPpt.BasicLibraries)
If xlc.hasElements Then
Dim strLibraries() As String =
xlc.getElementNames
For p1 As
Integer = 0 To
strLibraries.Length - 1
xlc.removeLibrary(strLibraries(p1))
Next
End If
'Dialog Libraries
xlc = _objProperty(NOO.enmCalcDocPpt.DialogLibraries)
If xlc.hasElements Then
Dim strLibraries() As String =
xlc.getElementNames
For p1 As
Integer = 0 To
strLibraries.Length - 1
xlc.removeLibrary(strLibraries(p1))
Next
End If
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' copy
Events from another docopy
''' </summary>
''' <param name="ndocFrom">nNOOCalcDoc</param>
Public
Function nfEventsCopy _
(ByVal ndocFrom As
nNCalcDoc _
) As Boolean
Try
Dim xesFrom As
unoidl.com.sun.star.document.XEventsSupplier = ndocFrom.g_doc
Dim xnrFrom As
unoidl.com.sun.star.container.XNameReplace = xesFrom.getEvents
Dim xesTo As
unoidl.com.sun.star.document.XEventsSupplier = g_doc
Dim xnrTo As
unoidl.com.sun.star.container.XNameReplace = xesTo.getEvents
Dim
strs() As String
= xnrFrom.getElementNames
For p1 As
Integer = 0 To
strs.Length - 1
Dim uany As
uno.Any = xnrFrom.getByName(strs(p1))
If uany.Value IsNot
Nothing Then
xnrTo.replaceByName(strs(p1), uany)
End If
Next
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
remove Events
''' </summary>
Public
Function nfRemoveEvents _
( _
) As Boolean
Try
Dim xes As
unoidl.com.sun.star.document.XEventsSupplier = g_doc
Dim xnr As
unoidl.com.sun.star.container.XNameReplace = xes.getEvents
Dim strs() As
String = xnr.getElementNames
For p1 As
Integer = 0 To
strs.Length - 1
'Dim a As uno.Any =
xnrFrom.getByName(strs(p1))
xnr.replaceByName(strs(p1), Nothing)
Next
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' copy
Page,CellStyle from another doc
''' </summary>
''' <param name="ndocFrom">nNOOCalcDoc</param>
Public
Function nfStyleCopy _
(ByVal ndocFrom As
nNCalcDoc _
) As Boolean
Try
Dim xsfsFrom As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = _
ndocFrom.g_doc
Dim xnaFrom As
unoidl.com.sun.star.container.XNameAccess = _
xsfsFrom.getStyleFamilies
Dim strStyles() As
String = xnaFrom.getElementNames
Dim xsfsTo As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xnaTo As
unoidl.com.sun.star.container.XNameAccess = _
xsfsTo.getStyleFamilies
Dim xmsfTo As
unoidl.com.sun.star.lang.XMultiServiceFactory = g_doc
For p1 As
Integer = 0 To
strStyles.Length - 1
Dim xncFrom As
unoidl.com.sun.star.container.XNameContainer = _
xnaFrom.getByName(strStyles(p1)).Value()
Dim
strFromStyleNames() As String
= xncFrom.getElementNames
Dim xncTo As
unoidl.com.sun.star.container.XNameContainer = _
xnaTo.getByName(strStyles(p1)).Value
For p2 As
Integer = 0 To
strFromStyleNames.Length - 1
Dim strStyleName As String = strFromStyleNames(p2)
If xncTo.hasByName(strStyleName) = False Then
Dim xstTo As
unoidl.com.sun.star.style.XStyle = Nothing
If strStyles(p1) =
"PageStyles" Then
xstTo
= xmsfTo.createInstance("com.sun.star.style.PageStyle")
Else
xstTo = xmsfTo.createInstance("com.sun.star.style.CellStyle")
End If
xstTo.setName(strStyleName)
xncTo.insertByName(strStyleName _
, New uno.Any(xstTo.GetType, xstTo) _
)
End If
'by default CellStyles HoriJustify is changed
to Standard-->Left
Dim intHoriJustify As Integer = 0
If strStyles(p1) =
"CellStyles" Then
intHoriJustify = NOO._objProperty(xncFrom.getByName(strStyleName).Value
_
, "HoriJustify" _
)
End If
NOO.nfPropertyValueCopy(xncFrom.getByName(strStyleName).Value _
, xncTo.getByName(strStyleName).Value _
)
'NOO.nfPropertyDisplay(xncFrom.getByName(strStyleName).Value)
'NOO.nfPropertyDisplay(xncTo.getByName(strStyleName).Value)
If strStyles(p1) =
"CellStyles" Then
NOO._objProperty(xncTo.getByName(strStyleName).Value _
, "HoriJustify" _
) = intHoriJustify
End If
Next
Next
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' add
Style
''' </summary>
''' <param name="strStyleName">StyleName</param>
''' <param name="strTemplateStyleName">TemplateStyleName</param>
''' <param name="blnPageStyle">true=PageStyle</param>
Public
Function nfAddStyle _
(ByVal strStyleName As
String _
, Optional ByVal
strTemplateStyleName As String = "Default" _
, Optional ByVal
blnPageStyle As Boolean
= True _
) As Boolean
Try
If NStr.nfCompare(strStyleName,
strTemplateStyleName) = 0 Then
NError.nfRaise(strStyleName, "strStyleName=strTemplateStyleName
error")
End If
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xna As
unoidl.com.sun.star.container.XNameAccess = xfs.getStyleFamilies
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xna.getByName("PageStyles").Value
If blnPageStyle = False Then
xnc = xna.getByName("CellStyles").Value
End If
If xnc.hasByName(strTemplateStyleName) =
False Then
NError.nfRaise(strTemplateStyleName, "strTemplateStyleName
error")
End If
If xnc.hasByName(strStyleName) = False Then
Dim xmsf As
unoidl.com.sun.star.lang.XMultiServiceFactory = _doc
Dim xst As
unoidl.com.sun.star.style.XStyle = _
xmsf.createInstance("com.sun.star.style.PageStyle")
If blnPageStyle = False Then
xst = xmsf.createInstance("com.sun.star.style.CellStyle")
End If
xst.setName(strStyleName)
xnc.insertByName(strStyleName, New
uno.Any(xst.GetType, xst))
End If
If strTemplateStyleName <>
"" Then
NOO.nfPropertyValueCopy(xnc.getByName(strTemplateStyleName).Value _
, xnc.getByName(strStyleName).Value _
)
End If
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
remove Style
''' </summary>
''' <param name="strStyleName">StyleName null=qll style</param>
''' <param name="blnPageStyle">true=PageStyle fals=CellStyle</param>
Public
Function nfRemoveStyle _
(ByVal strStyleName As
String _
, Optional ByVal
blnPageStyle As Boolean
= True _
) As Boolean
Try
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xna As
unoidl.com.sun.star.container.XNameAccess = xfs.getStyleFamilies
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xna.getByName("PageStyles").Value
If blnPageStyle = False Then
xnc = xna.getByName("CellStyles").Value
End If
If strStyleName <> "" Then
If xnc.hasByName(strStyleName) = False Then
NError.nfRaise(strStyleName, "strStyleName error")
End If
xnc.removeByName(strStyleName)
Else
Dim strStyleNames() As String =
xnc.getElementNames
For p1 As
Integer = 0 To
strStyleNames.Length - 1
If strStyleNames(p1) <>
"Default" Then
xnc.removeByName(strStyleNames(p1))
End If
Next
End If
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Dispatch
''' </summary>
''' <param name="strURL">URL set after .uno:</param>
''' <param name="pvs">array og PropertyValue</param>
Public
Function nfDispatch _
(ByVal strURL As String _
, Optional ByVal pvs() As unoidl.com.sun.star.beans.PropertyValue = Nothing _
) As Boolean
Try
If strURL = "" Then
NError.nfRaise("", "strURL=null error")
End If
Dim pvs1() As
unoidl.com.sun.star.beans.PropertyValue = Nothing
If pvs Is
Nothing Then
pvs1 = New
unoidl.com.sun.star.beans.PropertyValue() {}
Else
pvs1 = pvs
End If
g_ncalc.g_xdh.executeDispatch(_CurrentController.getFrame _
, ".uno:" & strURL _
, "" _
, 0 _
, pvs1 _
)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' save
the doc of Create or Open
''' </summary>
''' <param name="strDocFile">DocName</param>
''' <param name="strPassword">Password</param>
''' <param name="blnReadOnly">true=ReadOnly</param>
''' <param name="blnOverwrite">true=overwrite</param>
Public
Function nfSaveAs _
(ByVal strDocFile As String _
, Optional ByVal
strPassword As String
= "" _
, Optional ByVal
blnReadOnly As Boolean
= False _
, Optional ByVal
blnOverwrite As Boolean
= True _
, Optional ByVal
strActiveSheet As String
= "" _
, Optional ByVal
strActiveCell As String
= "" _
) As Boolean
Try
If g_blnCreate = True Then
Dim
xss As unoidl.com.sun.star.sheet.XSpreadsheets
= g_doc.getSheets
If xss IsNot
Nothing Then
Dim strNames() As
String = xss.getElementNames
If strNames.Length > 1 Then
nfRemoveSheet("__NDummy")
Else
If strNames(0) = "__NDummy" Then
Dim sheet As
unoidl.com.sun.star.sheet.XSpreadsheet = _
xss.getByName(strNames(0)).Value
Dim named As
unoidl.com.sun.star.container.XNamed = sheet
named.setName("Sheet1")
Else
NError.nfRaise("", "not exists Sheet")
End If
End If
End If
End If
Dim strURL As
String = NIO.nfFilePathToFileURL(strDocFile)
If NIO.nfFileExists(strDocFile) =
"" Then
If NIO.nfCheckSamePath(strDocFile,
g_strDocFile, True) = False
Then
Dim strError As
String = NIO.nfExclusiveOpenCheck(strDocFile)
If strError <> "" Then
NError.nfRaise(strDocFile & vbLf & strError _
, "DocFile error" _
)
End If
End If
If NIO.nfIsReadOnly(strDocFile) Then
NIO.nfRemovePathAttributes(strDocFile, IO.FileAttributes.ReadOnly)
End If
End If
'Dim xfrm As unoidl.com.sun.star.frame.XFrame
= _CurrentController.getFrame
'Dim xwnd As unoidl.com.sun.star.awt.XWindow =
xfrm.getContainerWindow
'xwnd.setEnable(True)
'xwnd.setFocus()
If strActiveSheet <> "" Then
'unless Visible=true we cant set
_blnVisible = True
nfSheetActivate(strActiveSheet)
If strActiveCell <> "" Then
Dim nsheet As
nNCalcSheet = nfGetSheet(strActiveSheet)
Dim nrng As
nNCalcRange = nsheet.nfGetRange(strActiveCell)
nfSelect(nrng._Range)
End If
_blnVisible
= False
End If
Dim npv As
New nNOOPropertyValue
If blnOverwrite = True Then
npv.nfAdd("Overwrite", True)
End If
g_strPassword = strPassword
Dim xstb As
unoidl.com.sun.star.frame.XStorable = g_doc
If strDocFile.EndsWith(".xls",
NConst.scOrdinalIC) Then
If strPassword <> "" Then
npv.nfAdd("Password", strPassword)
End If
npv.nfAdd("FilterName", "MS Excel 97")
xstb.storeAsURL(strURL,
npv._PropertyValues)
ElseIf
strDocFile.EndsWith(".pdf", NConst.scOrdinalIC) Then
If NOffice.nfIsAdobeReaderInstalled = False Then
NError.nfRaise("", "AdobeReader is not installed
error")
End If
Dim npv1 As
New nNOOPropertyValue
npv1.nfAdd("FilterName", "calc_pdf_Export")
'when use uno:ExportToPDF OptionDialog will be
displayed
If strPassword <> "" Then
Dim npv2 As
New nNOOPropertyValue()
'npv2.nfAdd("UseLosslessCompression",
False)
'npv2.nfAdd("Quality", 90)
'npv2.nfAdd("ReduceImageResolution",
False)
'npv2.nfAdd("MaxImageResolution",
300)
'npv2.nfAdd("UseTaggedPDF", False)
'npv2.nfAdd("SelectPdfVersion", 0)
'npv2.nfAdd("ExportNotes", False)
'npv2.nfAdd("ExportBookmarks", True)
'npv2.nfAdd("OpenBookmarkLevels",
-1)
'npv2.nfAdd("UseTransitionEffects",
True)
'npv2.nfAdd("IsSkipEmptyPages",
True)
'npv2.nfAdd("IsAddStream", False)
'npv2.nfAdd("FormsType", 0)
'npv2.nfAdd("ExportFormFields",
True)
'npv2.nfAdd("HideViewerToolbar",
False)
'npv2.nfAdd("HideViewerMenubar",
False)
'npv2.nfAdd("HideViewerWindowControls",
False)
'npv2.nfAdd("ResizeWindowToInitialPage",
False)
'npv2.nfAdd("CenterWindow", False)
'npv2.nfAdd("OpenInFullScreenMode",
False)
'npv2.nfAdd("DisplayPDFDocumentTitle",
True)
'npv2.nfAdd("InitialView", 0)
'npv2.nfAdd("Magnification", 0)
'npv2.nfAdd("Zoom", 100)
'npv2.nfAdd("PageLayout", 0)
'npv2.nfAdd("FirstPageOnLeft",
False)
'npv2.nfAdd("InitialPage", 1)
'npv2.nfAdd("Printing", 2)
'npv2.nfAdd("Changes", 4)
'npv2.nfAdd("EnableCopyingOfContent",
True)
'npv2.nfAdd("EnableTextAccessForAccessibilityTools",
True)
'npv2.nfAdd("ExportLinksRelativeFsys",
False)
'npv2.nfAdd("PDFViewSelection", 0)
'npv2.nfAdd("ConvertOOoTargetToPDFTarget",
False)
'npv2.nfAdd("ExportBookmarksToPDFDestination",
False)
'npv2.nfAdd("_OkButtonString",
"")
npv2.nfAdd("EncryptFile", True)
npv2.nfAdd("DocumentOpenPassword", strPassword)
npv1.nfAdd("FilterData", npv2._PropertyValues)
End If
'npv1.nfAdd("SelectionOnly", False)
'nfDispatch("ExportToPDF",
npv1._PropertyValues)
xstb.storeToURL(strURL, npv1._PropertyValues)
Else
If strPassword <> "" Then
npv.nfAdd("Password", strPassword)
End If
xstb.storeAsURL(strURL, npv._PropertyValues)
'xstb.storeToURL(strURL, npv._PropertyValues)
End If
If blnReadOnly = True Then
NIO.nfAddPathAttributes(strDocFile, IO.FileAttributes.ReadOnly)
End If
g_strDocFile = strDocFile
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' save
Open Docfile
''' </summary>
''' <param name="strPassword">Password</param>
''' <param name="blnReadOnly">true=ReadOnly</param>
Public
Function nfSave _
(Optional ByVal strPassword
As String =
"" _
, Optional ByVal
blnReadOnly As Boolean
= False _
, Optional ByVal
strActiveSheet As String
= "" _
, Optional ByVal
strActiveCell As String
= "" _
) As Boolean
Try
If g_strDocFile = "" Then
NError.nfRaise("", "strDocFile=null error")
End If
nfSaveAs(g_strDocFile _
, strPassword _
, blnReadOnly _
, _
, strActiveSheet _
, strActiveCell _
)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
close of Open Doc
''' </summary>
Public
Function nfClose _
( _
) As Boolean
Try
If g_doc IsNot
Nothing Then
g_ncalc.nfDocClose(Me)
g_doc = Nothing
End If
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
ActionLock
''' </summary>
''' <param name="blnAdd">true=ActionLock</param>
Public
Function nfActionLock _
(ByVal blnAdd As Boolean _
) As Boolean
Try
Dim xal As
unoidl.com.sun.star.document.XActionLockable = g_doc
If blnAdd = True
Then
If xal.isActionLocked = False Then
xal.addActionLock()
End If
Else
If xal.isActionLocked Then
xal.removeActionLock()
End If
End If
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' Doc
Close and display
''' </summary>
''' <param name="blnWaitForExit"></param>
Public
Function nfDisplay _
(Optional ByVal
blnWaitForExit As Boolean
= False _
) As Boolean
Try
If g_doc IsNot
Nothing Then
nfClose()
End If
'g_ncalc.nfDisplay(strDocFile,
blnWaitForExit, g_strPassword)
If
g_strDocFile.EndsWith(".xls", NConst.scOrdinalIC) Then
Dim ndoc As
nNCalcDoc = g_ncalc.nfDocOpen(g_strDocFile _
, g_strPassword _
, False _
, False _
)
ndoc.nfSave()
'ndoc.nfClose()
'Do
'
'Threading.Thread.Sleep(200)
'
Application.DoEvents()
'
If ndoc.nfIsAlive = False Then
' Exit Do
'
End If
'Loop
Return True
End If
Dim prc As
New Process
prc.StartInfo.FileName = g_strDocFile
prc.Start()
'prc.StartInfo.FileName = "C:\Program
Files\OpenOffice.org 3\program\soffice.exe"
'prc.StartInfo.WorkingDirectory =
"C:\Program Files\OpenOffice.org 3\Basis\program\"
'prc.StartInfo.Verb = "runas"
'prc.StartInfo.Arguments = strDocName
'prc.StartInfo.UseShellExecute = True
'prc.Start()
If blnWaitForExit = True Then
prc.WaitForExit()
prc.Dispose()
End If
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Print
''' </summary>
''' <param name="strPrinterName">PrinterName</param>
''' <param name="shtNumCopies">NumCopies</param>
Public
Function nfPrint _
(Optional ByVal
strPrinterName As String
= "" _
, Optional ByVal
shtNumCopies As Short
= 1 _
) As Boolean
Try
'in Hidden unable to print
_blnVisible = True
NSleep.nfExecute(100)
Dim nprint As
New nNOOPrinter(g_doc)
nprint.nfPrint(strPrinterName, shtNumCopies)
_blnVisible = False
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
IsAlive
''' </summary>
Public
Function nfIsAlive _
( _
) As Boolean
Try
Dim xmdl As
unoidl.com.sun.star.frame.XModel = g_doc
Dim xc As
unoidl.com.sun.star.frame.XController = xmdl.getCurrentController
Return True
Catch ex As Exception
Return False
End Try
End
Function
''' <summary>
'''
DocFile
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_strDocFile() As String
Get
Return g_strDocFile
End Get
End
Property
''' <summary>
'''
CurrentController
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_CurrentController _
( _
) As unoidl.com.sun.star.frame.XController
Get
Dim xmdl As
unoidl.com.sun.star.frame.XModel = g_doc
Dim xcc As
unoidl.com.sun.star.frame.XController = xmdl.getCurrentController
Return xcc
End Get
End
Property
''' <summary>
'''
StyleNames
''' </summary>
''' <param name="blnPageStyle">true=PageStyles false=CellStyles</param>
<Browsable(False)> _
Public
ReadOnly Property
_strStyleNames _
(ByVal blnPageStyle As
Boolean _
) As String()
Get
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xna As
unoidl.com.sun.star.container.XNameAccess = xfs.getStyleFamilies
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xna.getByName("PageStyles").Value
If blnPageStyle = False Then
xnc = xna.getByName("CellStyles").Value
End If
Return xnc.getElementNames
End Get
End
Property
''' <summary>
'''
XSpreadsheetDocument
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_doc _
( _
) As unoidl.com.sun.star.sheet.XSpreadsheetDocument
Get
Return g_doc
End Get
End
Property
''' <summary>
'''
Visible
''' </summary>
<Browsable(False)> _
Public
Property _blnVisible _
( _
) As Boolean
Get
Dim xfrm As
unoidl.com.sun.star.frame.XFrame = _CurrentController.getFrame
Dim xwnd2 As
unoidl.com.sun.star.awt.XWindow2 = xfrm.getContainerWindow
Return xwnd2.isVisible
End Get
Set(ByVal Value As Boolean)
Try
Dim xfrm As
unoidl.com.sun.star.frame.XFrame = _CurrentController.getFrame
Dim xwnd As
unoidl.com.sun.star.awt.XWindow = xfrm.getContainerWindow
xwnd.setVisible(Value)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''''
<summary>
''''
PrinterName
''''
</summary>
'<Browsable(False)>
_
'Public
Property _strPrinterName _
' ( _
' ) As String
' Get
' Dim nprinter As
New nNPrinter(g_doc)
' Return
nprinter._strPrinterName
' End Get
' Set(ByVal Value As String)
' Try
'
Dim nprinter As New nNPrinter(g_doc)
'
nprinter._strPrinterName = Value
' Catch ex As
Exception
'
NError.nfShow(ex, Err.Number)
' End Try
' End Set
'End
Property
''' <summary>
''' DocumentFontName
''' </summary>
<Browsable(False)> _
Public
Property _strDocFontName _
( _
) As String
Get
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("CellStyles").Value
Dim xst As
unoidl.com.sun.star.style.XStyle = xnc.getByName("Default").Value
'NOO.nfPropertyDisplay(xst)
Return NOO._objProperty(xst,
"CharFontNameAsian")
End Get
Set(ByVal value As String)
Try
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("CellStyles").Value
Dim xst As
unoidl.com.sun.star.style.XStyle = xnc.getByName("Default").Value
NOO._objProperty(xst, "CharFontName") = value
NOO._objProperty(xst, "CharFontNameAsian") = value
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
Document FontSize(point)
'''
[exp]process after add sheet
''' </summary>
<Browsable(False)> _
Public
Property _sngDocFontSize _
( _
) As Single
Get
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("CellStyles").Value
Dim xst As
unoidl.com.sun.star.style.XStyle = xnc.getByName("Default").Value
Return NOO._objProperty(xst,
"CharHeightAsian")
End Get
Set(ByVal value As Single)
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("CellStyles").Value
Dim xst As
unoidl.com.sun.star.style.XStyle = xnc.getByName("Default").Value
NOO._objProperty(xst, "CharHeight") = value
NOO._objProperty(xst, "CharHeightAsian") = value
'NOO.nfPropertyDisplay(xst)
End Set
End
Property
''' <summary>
'''
Document HorizontalJustify
''' </summary>
<Browsable(False)> _
Public
Property _enmHoriJustify _
( _
) As NOO.enmCellHoriJustify
Get
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("CellStyles").Value
Dim xst As
unoidl.com.sun.star.style.XStyle = xnc.getByName("Default").Value
Return NOO._objProperty(xst,
"HoriJustify")
End Get
Set(ByVal value As NOO.enmCellHoriJustify)
Dim xfs As unoidl.com.sun.star.style.XStyleFamiliesSupplier =
g_doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("CellStyles").Value
Dim xst As
unoidl.com.sun.star.style.XStyle = xnc.getByName("Default").Value
NOO._objProperty(xst, "HoriJustify") = NSS.nfCInt(value)
End Set
End
Property
''' <summary>
'''
Document VerticalJustify
''' </summary>
<Browsable(False)> _
Public
Property _enmVertJustify _
( _
) As NOO.enmCellVertJustify
Get
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("CellStyles").Value
Dim xst As
unoidl.com.sun.star.style.XStyle = xnc.getByName("Default").Value
Return NOO._objProperty(xst,
"VertJustify")
End Get
Set(ByVal value As NOO.enmCellVertJustify)
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("CellStyles").Value
Dim xst As
unoidl.com.sun.star.style.XStyle = xnc.getByName("Default").Value
NOO._objProperty(xst,
"VertJustify") = NSS.nfCInt(value)
End Set
End
Property
''' <summary>
'''
Document Format
''' </summary>
<Browsable(False)> _
Public
Property _enmDocFormat _
( _
) As NOO.enmFormat
Get
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("CellStyles").Value
Dim xst As
unoidl.com.sun.star.style.XStyle = xnc.getByName("Default").Value
Return NOO._objProperty(xst,
"NumberFormat")
End Get
Set(ByVal value As NOO.enmFormat)
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("CellStyles").Value
Dim xst As
unoidl.com.sun.star.style.XStyle = xnc.getByName("Default").Value
NOO._objProperty(xst, "NumberFormat") = NSS.nfCInt(value)
End
Set
End
Property
''' <summary>
'''
Property
''' </summary>
<Browsable(False)> _
Public
Property _objProperty _
(ByVal enm As
NOO.enmCalcDocPpt _
) As Object
Get
Dim strPropertyName As String =
[Enum].GetName(GetType(NOO.enmCalcDocPpt), enm)
Dim ps As
unoidl.com.sun.star.beans.XPropertySet = g_doc
If
ps.getPropertySetInfo.hasPropertyByName(strPropertyName) = True Then
Return
ps.getPropertyValue(strPropertyName).Value
End If
NError.nfRaise(strPropertyName, "strPropertyName error")
Return Nothing
End Get
Set(ByVal value As Object)
Try
Dim strPropertyName As String =
[Enum].GetName(GetType(NOO.enmCalcDocPpt) _
,
enm _
)
Dim ps As
unoidl.com.sun.star.beans.XPropertySet = g_doc
If
ps.getPropertySetInfo.hasPropertyByName(strPropertyName) = True Then
ps.setPropertyValue(strPropertyName _
, New uno.Any(value.GetType, value) _
)
Else
NError.nfRaise(strPropertyName, "strPropertyName error")
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
''' Cell
Property
''' </summary>
<Browsable(False)> _
Public
Property _objCellProperty _
(ByVal enm As
NOO.enmCalcCellPpt _
, Optional ByVal
strStyleName As String
= "Default" _
) As Object
Get
Dim strPropertyName As String =
[Enum].GetName(GetType(NOO.enmCalcCellPpt),
enm)
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("CellStyles").Value
Dim xps As
unoidl.com.sun.star.beans.XPropertySet = _
xnc.getByName(strStyleName).Value
If
xps.getPropertySetInfo.hasPropertyByName(strPropertyName) = True Then
Return
xps.getPropertyValue(strPropertyName).Value
End If
NError.nfRaise(strPropertyName, "strPropertyName error")
Return Nothing
End Get
Set(ByVal value As Object)
Try
Dim strPropertyName As String = _
[Enum].GetName(GetType(NOO.enmCalcCellPpt),
enm)
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("CellStyles").Value
Dim xps As
unoidl.com.sun.star.beans.XPropertySet = _
xnc.getByName(strStyleName).Value
If
xps.getPropertySetInfo.hasPropertyByName(strPropertyName) = True Then
xps.setPropertyValue(strPropertyName _
, New uno.Any(value.GetType, value) _
)
Else
NError.nfRaise(strPropertyName, "strPropertyName error")
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
Controller Property
''' </summary>
<Browsable(False)> _
Public
Property _objControllerProperty _
(ByVal enm As
NOO.enmCalcControllerPpt _
) As Object
Get
Return
NOO._objProperty(_CurrentController, enm.ToString)
End Get
Set(ByVal value As Object)
Try
NOO._objProperty(_CurrentController, enm.ToString) = value
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
ShowGrid
''' </summary>
<Browsable(False)> _
Public
Property _blnShowGrid _
( _
) As Boolean
Get
Return
_objControllerProperty(NOO.enmCalcControllerPpt.ShowGrid)
End Get
Set(ByVal value As Boolean)
Try
_objControllerProperty(NOO.enmCalcControllerPpt.ShowGrid) = value
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
ShowColumnRowHeader
''' </summary>
<Browsable(False)> _
Public
Property _blnShowColumnRowHeader _
( _
) As Boolean
Get
Return
_objControllerProperty(NOO.enmCalcControllerPpt.ColumnRowHeaders)
End Get
Set(ByVal value As Boolean)
Try
_objControllerProperty(NOO.enmCalcControllerPpt.ColumnRowHeaders) =
value
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
true=create
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_blnCreate _
( _
) As Boolean
Get
Return g_blnCreate
End Get
End
Property
''' <summary>
'''
MaxColumnAndRow
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_pntMaxColumnAndRow _
( _
) As Point
Get
Return g_pntMaxColumnAndRow
End Get
End
Property
End Class
3-3.nNCalcSheet
Imports System.ComponentModel
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
Public Class nNCalcSheet
Public g_ndoc As
nNCalcDoc
Private g_pntMaxUsed As
Point = Nothing '1-
Private g_sheet As
unoidl.com.sun.star.sheet.XSpreadsheet
Private g_pntLastAccess As
Point
Private
g_strLastAccessItem As String
Public Sub New _
(ByVal ndoc As
nNCalcDoc _
, ByVal sheet As
unoidl.com.sun.star.sheet.XSpreadsheet _
)
Try
g_ndoc = ndoc
g_sheet = sheet
Catch ex As Exception
NError.nfShow(ex,
Err.Number)
End Try
End Sub
''' <summary>RangeName-->Range change
''' [return]String *error xxxx--content------
''' </summary>
''' <param
name="strRangeName">Range
name A1 A* *1 King(1) King(*)
''' A#(#=used last Row) #1(#=used last Column)
''' row,column row,* *,column
''' [range] row1,column1:row2,column2 A1:A6 #=until used
Row,Column
''' cant use group(1):group(3)
''' </param>
''' <param
name="blnAsta">true=can use *
false=cant use</param>
Public Function
nfGetRange _
(ByVal strRangeName As
String _
, Optional ByVal
blnAsta As Boolean
= True _
) As nNCalcRange
Try
If blnAsta = False
AndAlso _
strRangeName.Contains("*"c) Then
NError.nfRaise(strRangeName, "RangeName form(cant use *)
error")
End If
strRangeName = strRangeName.Replace("$"c, "")
Dim pColon As
Integer = strRangeName.IndexOf(":"c)
If pColon = -1 Then
Return fChangeToRange(strRangeName)
End If
''''''range
Dim strRangeName1 As String =
Mid(strRangeName, 1, pColon).Trim
Dim nrng1 As
nNCalcRange = fChangeToRange(strRangeName1)
If nrng1 Is
Nothing Then
Return Nothing
End If
Dim strRangeName2 As String =
Mid(strRangeName, pColon + 2).Trim
Dim nrng2 As
nNCalcRange = fChangeToRange(strRangeName2)
If nrng2 Is
Nothing Then
Return Nothing
End If
Dim crab1 As
unoidl.com.sun.star.sheet.XCellRangeAddressable = nrng1._Range
Dim cra1 As
unoidl.com.sun.star.table.CellRangeAddress = crab1.getRangeAddress
Dim crab2 As
unoidl.com.sun.star.sheet.XCellRangeAddressable = nrng2._Range
Dim cra2 As
unoidl.com.sun.star.table.CellRangeAddress = crab2.getRangeAddress
If cra1.StartRow > cra2.EndRow OrElse _
cra1.StartColumn > cra2.EndColumn Then
Return Nothing
End If
Return New
nNCalcRange(Me _
,
g_sheet.getCellRangeByPosition(cra1.StartColumn _
, cra1.StartRow _
, cra2.EndColumn _
,
cra2.EndRow _
) _
)
Catch ex As Exception
g_ndoc.nfClose()
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
Private Function
fChangeToRange _
(ByVal strRangeName As
String _
) As nNCalcRange
Try
Dim pKakko As
Integer = strRangeName.IndexOf("("c)
''''group of cells group(1),group(*),group(#)
If pKakko <> -1 Then
'NTIMER.nfStart()
'For p1 As Integer = 0 To 1
'
For p2 As Integer = 0 To 65535
'
NTIMER.nfCheck(1)
' Dim mgb As
XMergeable = g_sheet.getCellByPosition(p1, p2)
'
'NTIMER.nfCheck(2)
' Dim bln As
Boolean = mgb.getIsMerged
' If bln = True
Then
'
NSS.nfDW(p1 & "," & p2, "")
' End If
' NTIMER.nfCheck(3)
'
Next
'Next
'NTIMER.nfShow()
Dim strName As
String = Mid(strRangeName, 1, pKakko).Trim
Dim nrng As
nNCalcRange = fGetNamedRange(strName)
If nrng Is
Nothing Then
Return Nothing
End If
''''''''group(nn)
Dim strIndex As
String = Mid(strRangeName, pKakko + 2) _
.Replace(")"c, "").Trim
If IsNumeric(strIndex) Then
Dim intIndex As Integer = NSS.nfCInt(strIndex)
If intIndex > nrng._intNumArrays Then
NError.nfRaise(strRangeName, "Index error")
End If
Return New
nNCalcRange(Me, nrng._Range(intIndex))
ElseIf strIndex = "*" OrElse _
strIndex = "#" Then
Return New
nNCalcRange(Me, nrng._Range)
Else
NError.nfRaise(strRangeName, "RangeName format error")
End If
End If
Dim pComma As
Integer = strRangeName.IndexOf(","c)
Dim pAsta As
Integer = strRangeName.IndexOf("*"c)
Dim pSharp As
Integer = strRangeName.IndexOf("#"c)
Dim strPoint As
String = ""
'''''''An,King
If pComma = -1 AndAlso
_
pAsta = -1 AndAlso _
pSharp = -1 Then
strPoint = NOffice.nfAnToPoint(strRangeName _
, False _
, g_ndoc._pntMaxColumnAndRow.X _
, g_ndoc._pntMaxColumnAndRow.Y _
)
If strPoint.Chars(0) = "*" Then
'''''''''named field
Dim nrng As
nNCalcRange = fGetNamedRange(strRangeName)
If nrng Is
Nothing Then
Return Nothing
Else
Return nrng
End If
End If
End If
Dim strRow As
String = ""
Dim strColumn As
String = ""
'''''nnn,nnn nnn,* #,nnn
If pComma <> -1 Then
strRow = Mid(strRangeName, 1, pComma).Trim
strColumn = Mid(strRangeName, pComma + 2).Trim
''''''''An A* A# x2 *2 #2 R1C1 R1* R1# *C1 #C1
Else
''''''''R1C1 R1C* R1C# R*C1 R#C1
Dim strItemUpper As String = strRangeName.ToUpper
If Mid(strItemUpper, 1, 1) =
"R" AndAlso _
NStr.nfInspectCount(strItemUpper, "C") = 1 Then
Dim p1 As
Integer = strItemUpper.IndexOf("C"c)
strRow = Mid(Mid(strItemUpper, 1, p1), 2).Trim
strColumn = Mid(strItemUpper, p1 + 2).Trim
'''''An A* A# *nn ** *#
Else
If strRangeName.Length < 2 Then
NError.nfRaise(strRangeName, "RangeName format error")
End If
''''''*n #n
If Mid(strRangeName, 1, 1) =
"#" OrElse _
Mid(strRangeName, 1, 1) = "*" Then
strColumn
= Mid(strRangeName, 1, 1)
strRow = Mid(strRangeName, 2).Trim
''''''A* A#
ElseIf Mid(strRangeName,
strRangeName.Length, 1) = "#" OrElse
_
Mid(strRangeName, strRangeName.Length, 1) = "*" Then
strColumn = _
NOffice.nfColumnToNO(Mid(strRangeName, 1, strRangeName.Length - 1))
If strColumn = "0" Then
NError.nfRaise(strRangeName, "RangeName format error")
End If
strRow = Mid(strRangeName, strRangeName.Length, 1)
'''''Ann,IVnn
Else
Dim pnt As
Point = NSS.nfCPoint(strPoint)
strRow = pnt.Y
strColumn
= pnt.X
End If
End If
End If
Dim pnt1 As
Point = Nothing
Dim pnt2 As
Point = Nothing
If IsNumeric(strRow) Then
If NSS.nfIsNumber(strRow) = False Then
NError.nfRaise(strRangeName,
"RangeName format(Row) error")
End If
pnt1.Y = strRow
If pnt1.Y < 1 Then
NError.nfRaise(strRangeName, "RangeName format(Row) error")
End If
If pnt1.Y >
g_ndoc._pntMaxColumnAndRow.Y Then
NError.nfRaise(strRangeName, "RangeName(Row) Over")
End If
ElseIf strRow = "*" Then
pnt1.Y = 1
pnt2.Y = g_ndoc._pntMaxColumnAndRow.Y
ElseIf strRow = "#" Then
pnt1.Y = 1
pnt2.Y = nfGetMaxUsedPoint.Y
Else
NError.nfRaise(strRangeName, "RangeName format(Row) error")
End If
If IsNumeric(strColumn) Then
If NSS.nfIsNumber(strColumn) = False Then
NError.nfRaise(strRangeName, "RangeName format(Column) error")
End If
pnt1.X = strColumn
If pnt1.X < 1 OrElse _
pnt1.X > g_ndoc._pntMaxColumnAndRow.X Then
NError.nfRaise(strRangeName, "RangeName format(Column) error")
End If
If pnt2.IsEmpty = False Then
pnt2.X = strColumn
End If
ElseIf strColumn = "*" Then
pnt1.X = 1
pnt2.X = g_ndoc._pntMaxColumnAndRow.X
If pnt2.Y = 0 Then
pnt2.Y = pnt1.Y
End If
ElseIf strColumn = "#" Then
pnt1.X = 1
pnt2.X = nfGetMaxUsedPoint.X
If pnt2.Y = 0 Then
pnt2.Y = pnt1.Y
End If
Else
NError.nfRaise(strRangeName, "RangeName format(Column) error")
End If
If pnt2.IsEmpty = True Then
pnt2 = pnt1
End If
Return New
nNCalcRange(Me _
, g_sheet.getCellRangeByPosition(pnt1.X - 1 _
, pnt1.Y - 1 _
, pnt2.X - 1 _
,
pnt2.Y - 1 _
) _
)
Catch ex As Exception
g_ndoc.nfClose()
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
Private Function
fGetNamedRange _
(ByVal strName As String _
) As nNCalcRange
Try
Dim xnrs As
unoidl.com.sun.star.sheet.XNamedRanges = _
g_ndoc._objProperty(NOO.enmCalcDocPpt.NamedRanges)
'20120402
Dim strName2 As
String = strName & "_" &
_strName
If xnrs.hasByName(strName2) = False Then
If xnrs.hasByName(strName) = False Then
NError.nfRaise(strName, "Name error")
End If
Else
strName = strName2
End If
Dim xrng As
unoidl.com.sun.star.table.XCellRange = _
g_sheet.getCellRangeByName(strName)
If xrng Is
Nothing Then
NError.nfRaise(strName, "strName is missing inSheet")
End If
Dim xcra As
unoidl.com.sun.star.sheet.XCellRangeAddressable = xrng
Dim cra As
unoidl.com.sun.star.table.CellRangeAddress = xcra.getRangeAddress
Dim mgb As
unoidl.com.sun.star.util.XMergeable = _
xrng.getCellByPosition(0, 0)
If mgb.getIsMerged = True Then
Dim cur As
unoidl.com.sun.star.sheet.XSheetCellCursor = _
g_sheet.createCursorByRange(mgb)
cur.collapseToMergedArea()
Dim xrab As
unoidl.com.sun.star.sheet.XCellRangeAddressable = cur
Dim cra1 As
unoidl.com.sun.star.table.CellRangeAddress = _
xrab.getRangeAddress
If cra1.EndColumn > cra.EndColumn Then
cra.EndColumn = cra1.EndColumn
End If
If cra1.EndRow > cra.EndRow Then
cra.EndRow = cra1.EndRow
End If
xrng = g_sheet.getCellRangeByPosition(cra.StartColumn _
, cra.StartRow _
, cra.EndColumn _
, cra.EndRow _
)
End If
Return New
nNCalcRange(Me, xrng)
Catch ex As Exception
g_ndoc.nfClose()
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>
''' GetRangeNames
''' </summary>
Public Function
nfGetRangeNames _
( _
) As String()
Try
Dim lstRangeNames As New List(Of String)
Dim xnrs As
unoidl.com.sun.star.sheet.XNamedRanges = _
g_ndoc._objProperty(NOO.enmCalcDocPpt.NamedRanges)
Dim xia As
unoidl.com.sun.star.container.XIndexAccess = xnrs
For p1 As
Integer = 0 To
xia.getCount - 1
Dim xnr As
unoidl.com.sun.star.sheet.XNamedRange = xia.getByIndex(p1).Value
Dim strName As
String = xnr.getName
'getReferencePosition cant get
'Dim ca As
unoidl.com.sun.star.table.CellAddress = xnr.getReferencePosition
Dim strContent As
String = xnr.getContent.Replace("$",
"")
Dim strSheetName As String = Mid(strContent, 1,
strContent.IndexOf("."c))
If strSheetName.Length > 2 AndAlso _
Mid(strSheetName, 1, 1) = "'" AndAlso
_
Mid(strSheetName, strSheetName.Length, 1) = "'" Then
strSheetName = Mid(strSheetName, 2, strSheetName.Length - 2)
End If
If NStr.nfCompare(strSheetName,
_strName) = 0 Then
lstRangeNames.Add(strName)
End If
'Dim xrng As
unoidl.com.sun.star.table.XCellRange = _
'
g_sheet.getCellRangeByName(strName)
'If xrng IsNot Nothing Then
'
lstRangeNames.Add(strName)
'End If
Next
Return lstRangeNames.ToArray
Catch ex As Exception
g_ndoc.nfClose()
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>
''' WriteRange
''' </summary>
''' <param
name="strRangeName">RangeName</param>
''' <param
name="strData">Data
''' if NO1 byte is NConst.vbNLfSubstitute ,its numeric
''' </param>
Public Function nfRangeWrite
_
(ByVal strRangeName As
String _
, ByVal strData As
String _
, Optional ByVal
blnExcludeSheetProtect As Boolean = False _
) As nNCalcRange
Try
Dim nrng As
nNCalcRange = nfGetRange(strRangeName, False)
If nrng Is Nothing Then
Return Nothing
End If
nrng.nfWrite(strData)
Return nrng
Catch ex As Exception
g_ndoc.nfClose()
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>
''' ReadRange
''' </summary>
''' <param
name="strRangeName">RangeName</param>
Public Function
nfRangeRead _
(ByVal strRangeName As
String _
) As String
Try
Dim nrng As
nNCalcRange = nfGetRange(strRangeName, True)
If nrng Is
Nothing Then
Return Nothing
End If
Return nrng.nfRead
Catch ex As Exception
g_ndoc.nfClose()
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>copy,insert with include sheet attribute
''' [return]string error
''' [exp]1line copy strFromRangeName=*5 strToCellName=A8
''' multiline copy strFromRangeName=A5:A7 strToCellName=A8
''' </summary>
''' <param
name="strFromRangeName">from
rangename </param>
''' <param
name="strToCellName">to
cellname </param>
''' <param
name="chrInsertMode">r=Line
c=column d=data is down R=data is right</param>
''' <param
name="blnInitialize">true=initalize
CopyArea</param>
''' <param
name="strFromSheet">FromSheet</param>
''' <param
name="objFromDoc">FromDocFile(string)
or nNOOCalcDoc</param>
Public Function
nfRangeCopy _
(ByVal strFromRangeName As
String _
, ByVal strToCellName As String _
, Optional ByVal
chrInsertMode As Char
= Nothing _
, Optional ByVal
blnInitialize As Boolean
= False _
, Optional ByVal
strFromSheet As String
= "" _
, Optional ByVal
objFromDoc As Object
= Nothing _
, Optional ByVal
strFromDocPassword As String
= "" _
) As Boolean
Try
''attributes is copied but height is not
copied. cant to another Doc
'Dim xcrm As XCellRangeMovement = g_sheet
'Dim rngDest As XCellRange =
g_sheet.getCellRangeByPosition(0, 1, 5, 1)
'Dim xcra As XCellRangeAddressable = rngDest
'Dim xca As XCellAddressable =
g_sheet.getCellByPosition(0, 15)
'xcrm.copyRange(xca.getCellAddress,
xcra.getRangeAddress)
'g_ndoc.nfSheetActivate(_strName)
'Dim xcrr As XColumnRowRange = g_sheet
'Dim xtrs As XTableRows = xcrr.getRows
'Dim rng As XCellRange =
xtrs.getByIndex(1).Value
'g_ndoc.nfSelect(rng)
'g_ndoc.nfDispatch("Copy")
''Dim rng1 As XCellRange = xtrs.getByIndex(14).Value
'Dim cell As XCell =
g_sheet.getCellByPosition(0, 14)
'g_ndoc.nfSelect(cell)
'g_ndoc.nfDispatch("Paste")
Dim strError As
String = ""
Dim nrngFrom As
nNCalcRange = Nothing
If objFromDoc IsNot
Nothing Then
Dim ndoc As
nNCalcDoc = Nothing
If objFromDoc.GetType Is GetType(String) Then
ndoc = g_ndoc.g_ncalc.nfDocOpen(objFromDoc, strFromDocPassword)
Else
ndoc = objFromDoc
End If
Dim strSheet As
String = strFromSheet
If strSheet = "" Then
strSheet = _strName
End If
Dim nsheet As
nNCalcSheet = ndoc.nfGetSheet(strSheet)
nrngFrom = nsheet.nfGetRange(strFromRangeName, True)
If nrngFrom Is
Nothing Then
Return False
End If
ndoc.nfSelect(nrngFrom._Range)
ndoc.nfDispatch("Copy")
If objFromDoc.GetType Is GetType(String) Then
ndoc.nfClose()
End If
ElseIf strFromSheet <>
"" Then
Dim nsheet As
nNCalcSheet = g_ndoc.nfGetSheet(strFromSheet)
'g_ndoc.nfSheetActivate(strFromSheet)
nrngFrom = nsheet.nfGetRange(strFromRangeName, True)
If nrngFrom Is
Nothing Then
Return False
End If
g_ndoc.nfSelect(nrngFrom._Range)
g_ndoc.nfDispatch("Copy")
Else
'Sheet in same Doc
g_ndoc.nfSheetActivate(_strName)
nrngFrom = nfGetRange(strFromRangeName, True)
If nrngFrom Is
Nothing Then
Return False
End If
'Dim nrngTo1 As nNOOCalcRange =
nfGetRange(strToCellName, True)
'If nrngFrom._rctRange.X = nrngTo1._rctRange.X
AndAlso _
'
nrngFrom._rctRange.Y = nrngTo1._rctRange.Y Then
'
Return False
'End If
g_ndoc.nfSelect(nrngFrom._Range)
g_ndoc.nfDispatch("Copy")
End If
Dim nrngTo As
nNCalcRange = nfGetRange(strToCellName, True)
If nrngTo Is
Nothing Then
Return False
End If
Dim rctFrom As
Rectangle = nrngFrom._rctRange
Dim rctTo As
Rectangle = nrngTo._rctRange
If rctFrom.Height > rctTo.Height Then
rctTo.Height = rctFrom.Height
End If
If rctFrom.Width > rctTo.Width Then
rctTo.Width = rctFrom.Width
End If
nrngTo = New nNCalcRange(Me _
,
g_sheet.getCellRangeByPosition(rctTo.Left _
, rctTo.Top _
, rctTo.Right - 1 _
,
rctTo.Bottom - 1 _
) _
)
'NSS.nfDW(nrngTo._strRangeAddress,
"111")
If chrInsertMode <> Nothing Then
fInsertNullRange(nrngTo, chrInsertMode)
End If
'NSS.nfDW(nrngTo._strRangeAddress,
"222")
g_ndoc.nfSelect(nrngTo._Range)
g_ndoc.nfDispatch("Paste")
If blnInitialize = True Then
nrngTo.nfClear()
End If
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>
''' InsertNullRange
''' [exp]in InserLine,InsertColumn, just before attribute
is set
''' </summary>
''' <param
name="strRangeName">RangeName</param>
''' <param
name="chrInsertMode">r=Line
c=column d=data is down R=data is right</param>
Public Function
nfInsertNullRange _
(ByVal strRangeName As
String _
, Optional ByVal
chrInsertMode As Char
= "r"c _
) As Boolean
Try
Dim nrng As
nNCalcRange = nfGetRange(strRangeName, True)
If nrng Is
Nothing Then
Return False
End If
Return fInsertNullRange(nrng,
chrInsertMode)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>
''' EraseSheetContent
''' </summary>
''' <param
name="strRangeName">RangeName</param>
''' <param
name="blnVALUE">numeric except
date,time</param>
''' <param
name="blnDATETIME">date,time</param>
''' <param
name="blnSTRING">string</param>
''' <param
name="blnOBJECTS">cell drawing
object</param>
''' <param
name="blnANNOTATION">comment of
cell</param>
''' <param
name="blnFORMULA">formula</param>
''' <param
name="blnHARDATTR">direct asign
format</param>
''' <param
name="blnSTYLES">indirect asign
format</param>
''' <param
name="blnEDITATTR">part of format</param>
Public Function
nfEraseSheetContent _
(ByVal strRangeName As
String _
, Optional ByVal
blnVALUE As Boolean
= True _
, Optional ByVal
blnDATETIME As Boolean
= True _
, Optional ByVal
blnSTRING As Boolean
= True _
, Optional ByVal
blnOBJECTS As Boolean
= True _
, Optional ByVal
blnANNOTATION As Boolean
= True _
, Optional ByVal
blnFORMULA As Boolean
= False _
, Optional ByVal
blnHARDATTR As Boolean
= True _
, Optional ByVal
blnSTYLES As Boolean
= False _
, Optional ByVal
blnEDITATTR As Boolean
= False _
) As Boolean
Try
Dim nrng As
nNCalcRange = nfGetRange(strRangeName, True)
If nrng Is
Nothing Then
Return False
End If
Return nrng.nfClear(blnVALUE _
, blnDATETIME _
, blnSTRING _
, blnOBJECTS _
, blnANNOTATION _
, blnFORMULA _
, blnHARDATTR _
, blnSTYLES _
, blnEDITATTR _
)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
Private Function
fInsertNullRange _
(ByRef nrng As
nNCalcRange _
, Optional ByVal
chrInsertMode As Char
= "r"c _
) As Boolean
Try
'NSS.nfDW(nrng._strRangeAddress, "")
Dim cim As
unoidl.com.sun.star.sheet.CellInsertMode = 0
If chrInsertMode = "r"c Then
cim = unoidl.com.sun.star.sheet.CellInsertMode.ROWS
ElseIf chrInsertMode = "c"c Then
cim = unoidl.com.sun.star.sheet.CellInsertMode.COLUMNS
ElseIf chrInsertMode = "d"c Then
cim
= unoidl.com.sun.star.sheet.CellInsertMode.DOWN
ElseIf chrInsertMode = "R"c Then
cim = unoidl.com.sun.star.sheet.CellInsertMode.RIGHT
Else
NError.nfRaise(chrInsertMode, "chrInsertMode error")
End If
Dim xcrm As
unoidl.com.sun.star.sheet.XCellRangeMovement = g_sheet
Dim xcra As
unoidl.com.sun.star.sheet.XCellRangeAddressable = nrng._Range
Dim cra As
unoidl.com.sun.star.table.CellRangeAddress = xcra.getRangeAddress
xcrm.insertCells(xcra.getRangeAddress,
cim)
'except re-set, occur insert characters slip
Dim rngNew As
unoidl.com.sun.star.table.XCellRange = _
g_sheet.getCellRangeByPosition(cra.StartColumn _
,
cra.StartRow _
, cra.EndColumn _
, cra.EndRow _
)
nrng = New nNCalcRange(Me, rngNew)
Return True
Catch
ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>
''' SetColumnDigits
''' </summary>
''' <param
name="intIndex">ColumnNO</param>
''' <param
name="intDigits">Digits</param>
Public Function
nfSetColumnDigits _
(ByVal intIndex As Integer _
, ByVal intDigits As Integer _
) As Boolean
Try
If intDigits < 1 Then
NError.nfRaise("", "intDigits<1 error")
End If
Dim siz As Size =
TextRenderer.MeasureText("0".PadRight(intDigits, "0") _
, New Font(_strSheetFontName _
, _sngSheetFontSize _
,
FontStyle.Regular _
) _
)
siz.Width += 1
siz.Height += 3
Dim sizf As
New SizeF(siz.Width /
NSystemInformation.nfScreenDPI.Width * 25.4 _
, siz.Height / NSystemInformation.nfScreenDPI.Height * 25.4 _
)
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_sheet
Dim xtcs As
unoidl.com.sun.star.table.XTableColumns = xcrr.getColumns
Dim xcr As
unoidl.com.sun.star.table.XCellRange = _
xtcs.getByIndex(intIndex - 1).Value
NOO._objProperty(xcr, "Width") = Convert.ToInt32(sizf.Width *
100)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>
''' ArrangeColumnWidth
''' </summary>
''' <param
name="intIndex">ColumnNO 0=all
used columns</param>
Public Function
nfArrangeColumnWidth _
(ByVal intIndex As Integer _
) As Boolean
Try
Dim pnt As
Point = nfGetMaxUsedPoint()
If intIndex = 0 Then
For int1 As
Integer = 1 To
pnt.X
fArrangeColumnWidth(int1, pnt.Y)
Next
Else
fArrangeColumnWidth(intIndex, pnt.Y)
End If
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
Private Function
fArrangeColumnWidth _
(ByVal intColumn As Integer _
, ByVal intMaxRow As Integer _
) As Boolean
Try
Dim nrng As
nNCalcRange = _
nfGetRange("1," & intColumn & ":" &
intMaxRow & "," & intColumn)
Dim obj()() As
Object = nrng.nfReadToArray
Dim intMax As
Integer = 0
For p1 As
Integer = 0 To
obj.Length - 1
If obj(p1)(0).GetType Is GetType(String) Then
Dim str As
String = obj(p1)(0)
If
str.StartsWith("[ImageFile]", NConst.scOrdinalIC) = False Then
Dim strLines() As
String = NStr.nfSplit(str.Replace(vbCr,
""), vbLf)
For p2 As
Integer = 0 To
strLines.Length - 1
If intMax < NSS.nfLenB(strLines(p2)) Then
intMax = NSS.nfLenB(strLines(p2))
End If
Next
End If
End If
Next
Dim siz As
Size = _
TextRenderer.MeasureText("0".PadRight(intMax,
"0") _
, New Font(_strSheetFontName _
, _sngSheetFontSize _
, FontStyle.Regular _
) _
)
siz.Width += 1
siz.Height += 3
Dim sizf As
New SizeF(siz.Width /
NSystemInformation.nfScreenDPI.Width * 25.4 _
, siz.Height / NSystemInformation.nfScreenDPI.Height * 25.4 _
)
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_sheet
Dim xtcs As
unoidl.com.sun.star.table.XTableColumns = xcrr.getColumns
Dim xcr As
unoidl.com.sun.star.table.XCellRange = _
xtcs.getByIndex(intColumn - 1).Value
NOO._objProperty(xcr, "Width") = Convert.ToInt32(sizf.Width *
100)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>
''' SetRowNum
''' </summary>
''' <param
name="intIndex">RowNO</param>
''' <param
name="intNum">num</param>
Public Function
nfSetRowNum _
(ByVal intIndex As Integer _
, ByVal intNum As
Integer _
) As Boolean
Try
If intNum < 1 Then
NError.nfRaise("", "intNum<1 error")
End If
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_sheet
Dim xtrs As
unoidl.com.sun.star.table.XTableRows = xcrr.getRows
Dim xcr As
unoidl.com.sun.star.table.XCellRange = _
xtrs.getByIndex(intIndex - 1).Value
NOO._objProperty(xcr, "Height") = _
Convert.ToInt32(_sngSheetRowHeight * intNum * 100)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>
''' get MaxUsedPoint
''' [return]point(1-)
''' </summary>
Public Function
nfGetMaxUsedPoint _
( _
) As Point
Try
'when ActionLocked,cant use
g_ndoc.nfActionLock(False)
Dim cur As
unoidl.com.sun.star.sheet.XSheetCellCursor = g_sheet.createCursor
Dim curUsed As
unoidl.com.sun.star.sheet.XUsedAreaCursor = cur
curUsed.gotoEndOfUsedArea(True)
Dim crab As
unoidl.com.sun.star.sheet.XCellRangeAddressable = curUsed
Dim cra As
unoidl.com.sun.star.table.CellRangeAddress = crab.getRangeAddress
g_pntMaxUsed = New Point(cra.EndColumn +
1, cra.EndRow + 1)
'NSS.nfDW(g_pntMaxUsed, _strName)
g_ndoc.nfActionLock(True)
Return g_pntMaxUsed
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>
''' Activate
''' </summary>
Public Function
nfActivate _
( _
) As Boolean
Try
Dim xsv As
unoidl.com.sun.star.sheet.XSpreadsheetView = g_ndoc._CurrentController
xsv.setActiveSheet(g_sheet)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>
''' remove Image
''' </summary>
''' <param
name="strName">Name null=all OLE</param>
''' <param
name="blnOLE">true=OLE
false=Shape</param>
Public Function
nfRemoveImage _
(ByVal strName As String _
, ByVal blnOLE As
Boolean _
) As Integer
Try
Dim xdps As
unoidl.com.sun.star.drawing.XDrawPageSupplier = g_sheet
Dim xdp As
unoidl.com.sun.star.drawing.XDrawPage = xdps.getDrawPage
Dim intCount As
Integer = 0
For p1 As
Integer = xdp.getCount - 1 To 0 Step -1
Dim xshp As
unoidl.com.sun.star.drawing.XShape = xdp.getByIndex(p1).Value
If (blnOLE = True
AndAlso _
xshp.getShapeType.ToString.Contains("OLE2Shape")) OrElse _
(blnOLE = False AndAlso
_
xshp.getShapeType.ToString.Contains("GraphicObjectShape")) Then
Dim xnamed As
unoidl.com.sun.star.container.XNamed = xshp
'NSS.nfDW(xnamed.getName, "")
If strName <> "" Then
If NStr.nfCompare(xnamed.getName,
strName) = 0 Then
xdp.remove(xshp)
intCount += 1
End If
Else
xdp.remove(xshp)
intCount += 1
End If
End If
Next
Return intCount
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>
''' ImageWrite
''' </summary>
''' <param
name="blnShape">true=Shape
false=OLE</param>
''' <param
name="strRangeName">RangeName</param>
''' <param
name="strFileName">FileName
ex)c:\aaa.bmp only Name is from DocFolder</param>
''' <param
name="strName">Name</param>
''' <param
name="siz">Empty=raw size 1/100mm</param>
''' <param
name="blnLink">true=Link false=embed</param>
Public Function
nfImageWrite _
(ByVal blnShape As Boolean _
, ByVal strRangeName As String _
, ByVal strFileName As String _
, ByVal strName As
String _
, ByVal siz As
Size _
, Optional ByVal
blnLink As Boolean
= False _
) As Boolean
Try
Dim nrng As
nNCalcRange = nfGetRange(strRangeName, False)
If nrng Is
Nothing Then
Return False
End If
Dim bln As
Boolean = False
If blnShape = True
Then
bln
= nrng.nfShapeDraw(strFileName, strName, siz, blnLink)
Else
bln = nrng.nfAddOLE(strFileName, strName, siz, blnLink)
End If
nrng = Nothing
Return bln
Catch ex As Exception
g_ndoc.nfClose()
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>
''' GetImages
''' </summary>
Public Function
nfGetImages _
( _
) As NOffice.g_ctypImage()
Try
Dim xdps As
unoidl.com.sun.star.drawing.XDrawPageSupplier = g_sheet
Dim xdp As
unoidl.com.sun.star.drawing.XDrawPage = xdps.getDrawPage
Dim lst As
New List(Of
NOffice.g_ctypImage)
For p1 As
Integer = xdp.getCount - 1 To 0 Step -1
Dim xshp As
unoidl.com.sun.star.drawing.XShape = xdp.getByIndex(p1).Value
Dim clsImage As
New NOffice.g_ctypImage
Dim xnamed As
unoidl.com.sun.star.container.XNamed = xshp
clsImage.strName = xnamed.getName
'Dim str As String = xshp.getShapeType.ToString
'NOO.nfPropertyDisplay(xshp)
If
xshp.getShapeType.ToString.Contains("OLE2Shape") Then
'Dim xeo As
unoidl.com.sun.star.embed.XEmbeddedObject = NOO._objProperty(xshp, "EmbeddedObject")
'Dim s1 As String = xeo.getClassName
'Dim xm As unoidl.com.sun.star.frame.XModel =
NOO._objProperty(xshp, "Model")
'Dim s2 As String = xm.getURL
clsImage.strType = "OLE"
clsImage.strLinkFile
= _
NIO.nfFileURLToFilePath(NOO._objProperty(xshp, "LinkURL"))
clsImage.strAddress = _
NOO.nfToDrawingPoint(xshp.getPosition).ToString
clsImage.strSize = _
NOO.nfToDrawingSize(xshp.getSize).ToString
ElseIf
xshp.getShapeType.ToString.Contains("GraphicObjectShape") Then
clsImage.strType = "Shape"
clsImage.strLinkFile = _
NIO.nfFileURLToFilePath(NOO._objProperty(xshp, "GraphicURL"))
clsImage.strAddress = _
NOO.nfToDrawingPoint(xshp.getPosition).ToString
clsImage.strSize = _
NOO.nfToDrawingSize(xshp.getSize).ToString
'NOO.nfPropertyDisplay(xshp)
ElseIf
xshp.getShapeType.ToString.Contains("GroupShape") Then
clsImage.strType = "GroupShape"
'NOO.nfPropertyDisplay(xshp)
'clsImage.strLinkFile = _
'
NIO.nfFileURLToFilePath(NOO._objProperty(xshp, "GraphicURL"))
clsImage.strAddress = _
NOO.nfToDrawingPoint(xshp.getPosition).ToString
clsImage.strSize = _
NOO.nfToDrawingSize(xshp.getSize).ToString
Else
NError.nfRaise(xshp.getShapeType.ToString, "xshp.getShapeType
error")
End If
lst.Add(clsImage)
Next
Return lst.ToArray
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>
''' SheetName
''' </summary>
<Browsable(False)> _
Public Property
_strName() As String
Get
Dim named As
unoidl.com.sun.star.container.XNamed = g_sheet
Return named.getName
End Get
Set(ByVal value As String)
Dim named As
unoidl.com.sun.star.container.XNamed = g_sheet
named.setName(value)
End Set
End Property
''' <summary>
''' XSpreadSheet
''' </summary>
<Browsable(False)> _
Public ReadOnly Property _sheet _
( _
) As unoidl.com.sun.star.sheet.XSpreadsheet
Get
Return g_sheet
End Get
End Property
''' <summary>
''' sheet protect
''' </summary>
<Browsable(False)> _
Public Property
_blnProtect _
(Optional ByVal
strPassword As String
= "" _
) As Boolean
Get
Dim xptbl As
unoidl.com.sun.star.util.XProtectable = g_sheet
Return xptbl.isProtected
End
Get
Set(ByVal value As Boolean)
Try
Dim xptbl As
unoidl.com.sun.star.util.XProtectable = g_sheet
If value = True
Then
xptbl.protect(strPassword)
Else
xptbl.unprotect(strPassword)
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' formula
''' </summary>
<Browsable(False)> _
Public Property
_strFormula _
(ByVal strRangeName As
String _
) As Boolean
Get
Dim nrng As
nNCalcRange = nfGetRange(strRangeName, False)
If nrng Is
Nothing Then
Return Nothing
End If
Return nrng._strFomula
End Get
Set(ByVal value As Boolean)
Try
Dim nrng As
nNCalcRange = nfGetRange(strRangeName, False)
If nrng Is
Nothing Then
Exit Property
End If
nrng._strFomula = value
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' SheetRowHeight
''' </summary>
''' <param
name="blnInch">true=inch false=mm</param>
<Browsable(False)> _
Public Property
_sngSheetRowHeight _
(Optional ByVal
blnInch As Boolean
= False _
) As Single
Get
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_sheet
Dim xtrs As
unoidl.com.sun.star.table.XTableRows = xcrr.getRows
Dim xcr As
unoidl.com.sun.star.table.XCellRange = xtrs.getByIndex(xtrs.getCount - 1).Value
If blnInch = True
Then
Return NOO._objProperty(xcr,
"Height") / 25.4 / 100
Else
Return NOO._objProperty(xcr,
"Height") / 100
End If
End Get
Set(ByVal value As Single)
If blnInch = True
Then
value = value * 25.4
End If
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_sheet
Dim xtrs As
unoidl.com.sun.star.table.XTableRows = xcrr.getRows
NOO._objProperty(xtrs, "Height") = Convert.ToInt32(value *
100)
End Set
End Property
''' <summary>
''' SheetColumnWidth
''' </summary>
''' <param
name="blnInch">true=inch false=mm</param>
<Browsable(False)> _
Public Property
_sngSheetColumnWidth _
(Optional ByVal
blnInch As Boolean
= False _
) As Single
Get
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_sheet
Dim xtcs As
unoidl.com.sun.star.table.XTableColumns = xcrr.getColumns
Dim xcr As
unoidl.com.sun.star.table.XCellRange = xtcs.getByIndex(xtcs.getCount - 1).Value
Dim sng As
Single = NOO._objProperty(xcr,
"Width") / 100
If blnInch = True
Then
Return sng / 25.4
Else
Return sng
End If
End Get
Set(ByVal value As Single)
If blnInch = True
Then
value = value * 25.4
End If
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_sheet
Dim xtcs As
unoidl.com.sun.star.table.XTableColumns = xcrr.getColumns
NOO._objProperty(xtcs, "Width") = Convert.ToInt32(value * 100)
End Set
End Property
''' <summary>
''' ColumnWidth
''' </summary>
''' <param name="intIndex">1-</param>
''' <param
name="blnInch">true=inch false=mm</param>
<Browsable(False)> _
Public Property
_sngColumnWidth _
(ByVal intIndex As Integer _
, Optional ByVal
blnInch As Boolean
= False _
) As Single
Get
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_sheet
Dim xtcs As
unoidl.com.sun.star.table.XTableColumns = xcrr.getColumns
Dim xcr As
unoidl.com.sun.star.table.XCellRange = xtcs.getByIndex(intIndex - 1).Value
NOO.nfPropertyDisplay(xcr)
Dim sng As
Single = NOO._objProperty(xcr,
"Width") / 100
If blnInch = True
Then
Return sng / 25.4
Else
Return sng
End If
End Get
Set(ByVal value As Single)
If blnInch = True
Then
value = value * 25.4
End If
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_sheet
Dim xtcs As
unoidl.com.sun.star.table.XTableColumns = xcrr.getColumns
Dim xcr As
unoidl.com.sun.star.table.XCellRange = _
xtcs.getByIndex(intIndex - 1).Value
NOO._objProperty(xcr, "Width") = Convert.ToInt32(value * 100)
End Set
End Property
''' <summary>
''' RowHeight
''' </summary>
''' <param name="intIndex">1-</param>
''' <param
name="blnInch">true=inch false=mm</param>
<Browsable(False)> _
Public Property
_sngRowHeight _
(ByVal intIndex As Integer _
, Optional ByVal
blnInch As Boolean
= False _
) As Single
Get
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_sheet
Dim xtrs As
unoidl.com.sun.star.table.XTableRows = xcrr.getRows
Dim xcr As
unoidl.com.sun.star.table.XCellRange = _
xtrs.getByIndex(intIndex - 1).Value
'NOO.nfPropertyDisplay(xcr)
If blnInch = True
Then
Return NOO._objProperty(xcr,
"Height") / 25.4 / 100
Else
Return NOO._objProperty(xcr,
"Height") / 100
End If
End Get
Set(ByVal value As Single)
If blnInch = True
Then
value = value * 25.4
End If
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_sheet
Dim xtrs As
unoidl.com.sun.star.table.XTableRows = xcrr.getRows
Dim xcr As
unoidl.com.sun.star.table.XCellRange = _
xtrs.getByIndex(intIndex - 1).Value
NOO._objProperty(xcr, "Height") = Convert.ToInt32(value * 100)
End Set
End Property
''' <summary>
''' Column HorizontalJustify
''' </summary>
''' <param
name="intIndex">1-</param>
<Browsable(False)> _
Public Property
_enmColumnHoriJustify _
(ByVal intIndex As Integer _
) As NOO.enmCellHoriJustify
Get
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_sheet
Dim xtcs As
unoidl.com.sun.star.table.XTableColumns = xcrr.getColumns
Dim xcr As
unoidl.com.sun.star.table.XCellRange = _
xtcs.getByIndex(intIndex - 1).Value
'NOO.nfPropertyDisplay(xcr)
Return NOO._objProperty(xcr,
"HoriJustify")
End Get
Set(ByVal value As NOO.enmCellHoriJustify)
Try
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_sheet
Dim xtcs As
unoidl.com.sun.star.table.XTableColumns = xcrr.getColumns
Dim xcr As
unoidl.com.sun.star.table.XCellRange = _
xtcs.getByIndex(intIndex - 1).Value
NOO._objProperty(xcr, "HoriJustify") = Convert.ToInt32(value)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' Row VerticalJustify
''' </summary>
''' <param
name="intIndex">1-</param>
<Browsable(False)> _
Public Property
_enmRowVertJustify _
(ByVal intIndex As Integer _
) As NOO.enmCellVertJustify
Get
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_sheet
Dim xtrs As
unoidl.com.sun.star.table.XTableRows = xcrr.getRows
Dim xcr As
unoidl.com.sun.star.table.XCellRange = xtrs.getByIndex(intIndex - 1).Value
'NOO.nfPropertyDisplay(xcr)
Return NOO._objProperty(xcr,
"VertJustify")
End Get
Set(ByVal value As NOO.enmCellVertJustify)
Try
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_sheet
Dim xtrs As
unoidl.com.sun.star.table.XTableRows = xcrr.getRows
Dim xcr As
unoidl.com.sun.star.table.XCellRange = _
xtrs.getByIndex(intIndex - 1).Value
NOO._objProperty(xcr, "VertJustify") = Convert.ToInt32(value)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' Sheet Font
''' </summary>
<Browsable(False)> _
Public Property
_fntSheetFont _
( _
) As Font
Get
Return New
Font(_strSheetFontName, _sngSheetFontSize, _fsSheetFontStyle)
End Get
Set(ByVal value As Font)
Try
_strSheetFontName = value.Name
_sngSheetFontSize =
value.Size
_fsSheetFontStyle = value.Style
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' Sheet FontName
''' </summary>
<Browsable(False)>
_
Public Property
_strSheetFontName _
( _
) As String
Get
Return
_objProperty(NOO.enmSheetPpt.CharFontNameAsian)
End Get
Set(ByVal value As String)
Try
_objProperty(NOO.enmSheetPpt.CharFontName) = value
_objProperty(NOO.enmSheetPpt.CharFontNameAsian) = value
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' Sheet FontSize(point)
''' </summary>
<Browsable(False)> _
Public Property
_sngSheetFontSize _
( _
) As Single
Get
Return
_objProperty(NOO.enmSheetPpt.CharHeight)
End Get
Set(ByVal value As Single)
_objProperty(NOO.enmSheetPpt.CharHeight) = value
_objProperty(NOO.enmSheetPpt.CharHeightAsian) = value
End Set
End Property
'''' <summary>
'''' sheet FontStyle ex)Italic Bold Strikeout Underline
'''' </summary>
'<Browsable(False)> _
'Public Property _strSheetFontStyle _
' ( _
' ) As
String
' Get
' Dim strStyle As
String = ""
' If
_objProperty(NOO.enmSheetPpt.CharPosture) =
unoidl.com.sun.star.awt.FontSlant.ITALIC Then
'
If strStyle <> "" Then
'
strStyle &= " "
'
End If
'
strStyle &= "Italic"
' End If
' If
_objProperty(NOO.enmSheetPpt.CharWeight) > 100 Then
'
If strStyle <> "" Then
'
strStyle &= " "
'
End If
'
strStyle &= "Bold"
' End If
' If
_objProperty(NOO.enmSheetPpt.CharStrikeout) <> 0 Then
'
If strStyle <> "" Then
'
strStyle &= " "
'
End If
'
strStyle &= "Strikeout"
' End If
' If
_objProperty(NOO.enmSheetPpt.CharUnderline) <> 0 Then
'
If strStyle <> "" Then
'
strStyle &= " "
'
End If
'
strStyle &= "Underline"
' End If
' Return strStyle
' End Get
'
Set(ByVal value As String)
' Try
'
If InStr(value, "strikeout", CompareMethod.Text) <> 0
Then
'
_objProperty(NOO.enmSheetPpt.CharStrikeout) =
CInt(NOO.enmFontStrikeout.SINGLE)
'
value = NStr.nfReplace(value, "strikeout", "")
'
End If
'
If InStr(value, "underline", CompareMethod.Text) <> 0
Then
'
_objProperty(NOO.enmSheetPpt.CharUnderline) =
CInt(NOO.enmFontUnderline.SINGLE)
'
value = NStr.nfReplace(value, "underline", "")
'
End If
'
If InStr(value, "bold", CompareMethod.Text) <> 0 Then
'
_objProperty(NOO.enmSheetPpt.CharWeight) =
_objProperty(NOO.enmSheetPpt.CharWeight) * 2
'
_objProperty(NOO.enmSheetPpt.CharWeightAsian) =
_objProperty(NOO.enmSheetPpt.CharWeightAsian) * 2
'
value = NStr.nfReplace(value, "bold", "")
'
End If
'
If InStr(value, "italic", CompareMethod.Text) <> 0 Then
'
_objProperty(NOO.enmSheetPpt.CharPosture) =
unoidl.com.sun.star.awt.FontSlant.ITALIC
'
_objProperty(NOO.enmSheetPpt.CharPostureAsian) =
unoidl.com.sun.star.awt.FontSlant.ITALIC
'
value = NStr.nfReplace(value, "bold", "")
'
End If
' Catch ex As
Exception
'
NError.nfShow(ex, Err.Number)
' End Try
' End Set
'End Property
''' <summary>
''' sheet FontStyle
''' </summary>
<Browsable(False)> _
Public Property
_fsSheetFontStyle _
( _
) As
FontStyle
Get
Dim fs As
New FontStyle
If
_objProperty(NOO.enmSheetPpt.CharPosture) =
unoidl.com.sun.star.awt.FontSlant.ITALIC Then
fs = fs Or FontStyle.Italic
End If
If _objProperty(NOO.enmSheetPpt.CharWeight)
> 100 Then
fs = fs Or FontStyle.Bold
End If
If
_objProperty(NOO.enmSheetPpt.CharStrikeout) <> 0 Then
fs = fs Or FontStyle.Strikeout
End If
If
_objProperty(NOO.enmSheetPpt.CharUnderline) <> 0 Then
fs = fs Or FontStyle.Underline
End If
Return fs
End Get
Set(ByVal value As FontStyle)
Try
If (value And
FontStyle.Strikeout) <> 0 Then
_objProperty(NOO.enmSheetPpt.CharStrikeout) = _
NSS.nfCInt(NOO.enmFontStrikeout.SINGLE)
End If
If (value And
FontStyle.Underline) <> 0 Then
_objProperty(NOO.enmSheetPpt.CharUnderline) = _
NSS.nfCInt(NOO.enmFontStrikeout.SINGLE)
End If
If (value And
FontStyle.Bold) <> 0 Then
_objProperty(NOO.enmSheetPpt.CharWeight) =
_objProperty(NOO.enmSheetPpt.CharWeight) * 2
_objProperty(NOO.enmSheetPpt.CharWeightAsian) =
_objProperty(NOO.enmSheetPpt.CharWeightAsian) * 2
End If
If (value And
FontStyle.Italic) <> 0 Then
_objProperty(NOO.enmSheetPpt.CharPosture) =
unoidl.com.sun.star.awt.FontSlant.ITALIC
_objProperty(NOO.enmSheetPpt.CharPostureAsian) =
unoidl.com.sun.star.awt.FontSlant.ITALIC
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' sheet CharColor
''' </summary>
<Browsable(False)> _
Public Property
_clrSheetCharColor _
( _
) As Color
Get
Return
Color.FromArgb(_objProperty(NOO.enmSheetPpt.CharColor))
End Get
Set(ByVal value As Color)
Try
_objProperty(NOO.enmSheetPpt.CharColor)
= value.R * 65536 _
+ value.G * 256 + value.B
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' BackColor
''' </summary>
<Browsable(False)> _
Public Property
_clrSheetBackColor _
( _
) As Color
Get
Return
Color.FromArgb(_objProperty(NOO.enmSheetPpt.CellBackColor))
End Get
Set(ByVal value As Color)
Try
If value.IsEmpty = False Then
_objProperty(NOO.enmSheetPpt.CellBackColor) = _
value.R * 65536 + value.G * 256 + value.B
_objProperty(NOO.enmSheetPpt.IsCellBackgroundTransparent) = False
Else
_objProperty(NOO.enmSheetPpt.IsCellBackgroundTransparent) = True
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' PageStyle
''' </summary>
<Browsable(False)> _
Public Property
_strPageStyle _
( _
) As String
Get
Return
_objProperty(NOO.enmSheetPpt.PageStyle)
End Get
Set(ByVal value As String)
Try
_objProperty(NOO.enmSheetPpt.PageStyle) = value
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' PageBreaks
''' [exp]BreakIndex(1-) array
''' </summary>
''' <param
name="blnColumn">true=column
false=row</param>
<Browsable(False)> _
Public Property
_intPageBreaks _
(Optional ByVal
blnColumn As Boolean
= False _
) As Integer()
Get
Dim xspb As
unoidl.com.sun.star.sheet.XSheetPageBreak = g_sheet
Dim tpbds() As
unoidl.com.sun.star.sheet.TablePageBreakData = Nothing
If blnColumn = False
Then
tpbds = xspb.getRowPageBreaks
Else
tpbds = xspb.getColumnPageBreaks
End If
Dim lst As
New List(Of Integer)
For p1 As
Integer = 0 To
tpbds.Length - 1
If tpbds(p1).ManualBreak = True Then
lst.Add(tpbds(p1).Position + 1)
End If
Next
Return lst.ToArray
End Get
Set(ByVal Values() As Integer)
Try
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_sheet
If blnColumn = False
Then
Dim xts As
unoidl.com.sun.star.table.XTableRows = xcrr.getRows
For p1 As
Integer = 0 To
Values.Length - 1
If Values(p1) < 2 OrElse _
Values(p1) > xts.getCount Then
NError.nfRaise(Values(p1), "Index error")
End If
Dim ps As
unoidl.com.sun.star.beans.XPropertySet = _
xts.getByIndex(Values(p1) - 1).Value
ps.setPropertyValue("IsStartOfNewPage" _
, New uno.Any(True)
_
)
Next
Else
Dim xts As
unoidl.com.sun.star.table.XTableColumns = xcrr.getColumns
For p1 As
Integer = 0 To
Values.Length - 1
If Values(p1) < 2 OrElse _
Values(p1) > xts.getCount Then
NError.nfRaise(Values(p1), "Index error")
End If
Dim ps As
unoidl.com.sun.star.beans.XPropertySet = _
xts.getByIndex(Values(p1) - 1).Value
ps.setPropertyValue("IsStartOfNewPage" _
, New uno.Any(True)
_
)
Next
End If
Catch ex As
Exception
NError.nfShow(ex,
Err.Number)
End Try
End Set
End Property
''' <summary>
''' FreezePane Point
''' [exp] (x,y) 1-
cant get in ExcelSheet
''' </summary>
<Browsable(False)> _
Public Property
_pntFreezePane _
( _
) As Point
Get
Dim xsv As
unoidl.com.sun.star.sheet.XSpreadsheetView = _
g_ndoc._CurrentController
xsv.setActiveSheet(g_sheet)
Dim xvf As
unoidl.com.sun.star.sheet.XViewFreezable = xsv
If xvf.hasFrozenPanes Then
Dim xvs As
unoidl.com.sun.star.sheet.XViewSplitable = xsv
Return New
Point(xvs.getSplitColumn + 1, xvs.getSplitRow + 1)
Else
Return New
Point(0, 0)
End If
End Get
Set(ByVal value As Point)
Try
'Dim xfrm As XFrame = xctl.getFrame
'Dim xw As unoidl.com.sun.star.awt.XWindow =
xfrm.getContainerWindow
Dim xsv As
unoidl.com.sun.star.sheet.XSpreadsheetView = _
g_ndoc._CurrentController
xsv.setActiveSheet(g_sheet)
Dim xpa As
unoidl.com.sun.star.sheet.XPrintAreas = g_sheet
'release
If value.IsEmpty Then
Dim xvs As
unoidl.com.sun.star.sheet.XViewSplitable = xsv
xvs.splitAtPosition(0, 0)
xpa.setTitleRows(Nothing)
xpa.setPrintTitleRows(False)
xpa.setTitleColumns(Nothing)
xpa.setPrintTitleColumns(False)
Else
'cant set in window visible=false(hidden)
(3.4.0 ok?)
'in row freeze SheetTabs collapse
If g_ndoc.g_ncalc._strVersion =
"3.2" Then
g_ndoc._blnVisible = True
End If
Dim xvf As
unoidl.com.sun.star.sheet.XViewFreezable = xsv
xvf.freezeAtPosition(value.X - 1, value.Y - 1)
If g_ndoc.g_ncalc._strVersion =
"3.2" Then
g_ndoc._blnVisible = False
End If
'Dim x As XRefreshable = g_ndoc._doc
'x.refresh()
'g_ndoc.nfDispatch("UpdateFields")
''''''''''Print (format > print range > edit)
Dim pntMax As
Point = g_ndoc._pntMaxColumnAndRow
If value.Y > 1 Then
Dim rng As
unoidl.com.sun.star.table.XCellRange = _
g_sheet.getCellRangeByPosition(0 _
, 0 _
, pntMax.X - 1 _
, value.Y - 2 _
)
Dim rab As
unoidl.com.sun.star.sheet.XCellRangeAddressable = rng
xpa.setTitleRows(rab.getRangeAddress)
xpa.setPrintTitleRows(True)
End If
If value.X > 1 Then
Dim rng As
unoidl.com.sun.star.table.XCellRange = _
g_sheet.getCellRangeByPosition(0 _
,
value.Y - 1 _
, value.X - 2 _
, pntMax.Y - 1 _
)
Dim rab As
unoidl.com.sun.star.sheet.XCellRangeAddressable = rng
xpa.setTitleColumns(rab.getRangeAddress)
xpa.setPrintTitleColumns(True)
End If
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' GridLineColor
''' </summary>
<Browsable(False)> _
Public Property
_clrGridLine _
( _
) As Color
Get
Return Color.FromArgb(g_ndoc._objControllerProperty(NOO.enmCalcControllerPpt.GridColor))
End Get
Set(ByVal value As Color)
Try
_objProperty(g_ndoc._objControllerProperty(NOO.enmCalcControllerPpt.GridColor))
= _
value.R * 65536 + value.G * 256 + value.B
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' Sheet Property
''' </summary>
<Browsable(False)> _
Public Property
_objProperty _
(ByVal enm As
NOO.enmSheetPpt _
) As Object
Get
Dim strPropertyName As String = _
[Enum].GetName(GetType(NOO.enmSheetPpt),
enm)
Dim ps As
unoidl.com.sun.star.beans.XPropertySet = g_sheet
If ps.getPropertySetInfo.hasPropertyByName(strPropertyName)
= True Then
Return
ps.getPropertyValue(strPropertyName).Value
End If
NError.nfRaise(strPropertyName, "strPropertyName error")
Return Nothing
End Get
Set(ByVal value As Object)
Try
Dim strPropertyName As String =
[Enum].GetName(GetType(NOO.enmSheetPpt), enm)
Dim ps As
unoidl.com.sun.star.beans.XPropertySet = g_sheet
If
ps.getPropertySetInfo.hasPropertyByName(strPropertyName) = True Then
ps.setPropertyValue(strPropertyName _
, New uno.Any(value.GetType, value) _
)
Else
NError.nfRaise(strPropertyName, "strPropertyName error")
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' PageSetup Property
''' </summary>
<Browsable(False)> _
Public Property
_objPageSetupPpt _
(ByVal enm As
NOO.enmCalcPageSetupPpt _
, Optional ByVal
strStyleName As String
= "" _
) As Object
Get
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
Dim strPropertyName As String = _
[Enum].GetName(GetType(NOO.enmCalcPageSetupPpt),
enm)
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_ndoc._doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("PageStyles").Value
Dim xps As
unoidl.com.sun.star.beans.XPropertySet = _
xnc.getByName(strStyleName).Value
If
xps.getPropertySetInfo.hasPropertyByName(strPropertyName) = True Then
Return xps.getPropertyValue(strPropertyName).Value
End If
NError.nfRaise(strPropertyName, "strPropertyName error")
Return Nothing
End Get
Set(ByVal value As Object)
Try
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
Dim strPropertyName As String = _
[Enum].GetName(GetType(NOO.enmCalcPageSetupPpt),
enm)
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_ndoc._doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("PageStyles").Value
Dim xps As
unoidl.com.sun.star.beans.XPropertySet = _
xnc.getByName(strStyleName).Value
If
xps.getPropertySetInfo.hasPropertyByName(strPropertyName) = True Then
xps.setPropertyValue(strPropertyName _
, New uno.Any(value.GetType, value) _
)
Else
NError.nfRaise(strPropertyName, "strPropertyName error")
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' PageHeader
''' <para>[exp]&p=PageNO</para>
''' <para>&n=PageCount</para>
''' <para>&d=Date</para>
''' <para>&t=Time</para>
''' <para>&c=ComputerName</para>
''' <para>&f=FileName</para>
''' <para>&s=SheetName</para>
''' <para>&T=DocumentTitle</para>
''' </summary>
''' <param
name="chrPlace">l=Left r=Right
c=Center</param>
''' <param
name="strStyleName">StyleName</param>
<Browsable(False)> _
Public Property
_strPageHeader _
(Optional ByVal
chrPlace As Char
= "r"c _
, Optional ByVal
strStyleName As String
= "" _
) As String
Get
Return ""
'Return fGetHeaderFooter(True, chrPart,
strStyleName)
End Get
Set(ByVal Value As String)
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
fSetHeaderFooter(True, chrPlace,
strStyleName, Value)
_sngHeaderBodyDistance = 0
End Set
End Property
''' <summary>
''' Footer
''' <para>[exp]&p=PageNO</para>
''' <para>&n=PageCount</para>
''' <para>&d=Date</para>
''' <para>&t=Time</para>
''' <para>&c=ComputerName</para>
''' <para>&f=FileName</para>
''' <para>&s=SheetName</para>
''' <para>&T=DocumentTitle</para>
''' </summary>
''' <param
name="chrPlace">l=Left r=Right
c=Center</param>
''' <param
name="strStyleName">StyleName</param>
<Browsable(False)> _
Public Property
_strPageFooter _
(Optional ByVal chrPlace
As Char =
"r"c _
, Optional ByVal
strStyleName As String
= "" _
) As String
Get
Return ""
'Return fGetHeaderFooter(False, chrPart,
strStyleName)
End Get
Set(ByVal Value As String)
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
fSetHeaderFooter(False, chrPlace,
strStyleName, Value)
_sngFooterBodyDistance = 0
End Set
End Property
Private Function
fGetHeaderFooter _
(ByVal blnHeader As Boolean _
, ByVal chrPart As
Char _
, ByVal strStyleName As String _
) As String
Try
Dim strStyleNames() As String =
g_ndoc._strStyleNames(True)
If Array.IndexOf(strStyleNames,
strStyleName) = -1 Then
NError.nfRaise(strStyleName,
"strStyleName error")
End If
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_ndoc._doc
Dim xna As
unoidl.com.sun.star.container.XNameAccess = xfs.getStyleFamilies
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xna.getByName("PageStyles").Value
Dim xstl As
unoidl.com.sun.star.style.XStyle = xnc.getByName(strStyleName).Value
Dim nuda As
New nNOOUserDefinedAttibutes(xstl)
If
blnHeader = True Then
Return
nuda._objAttribute("Header_" & strStyleName & "_"
& chrPart)
Else
Return
nuda._objAttribute("Footer_" & strStyleName & "_"
& chrPart)
End If
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
Private Function
fSetHeaderFooter _
(ByVal blnHeader As Boolean _
, ByVal chrPart As
Char _
, ByVal strStyleName As String _
, ByVal strData As
String _
) As Boolean
Try
Dim strStyleNames() As String =
g_ndoc._strStyleNames(True)
If Array.IndexOf(strStyleNames,
strStyleName) = -1 Then
NError.nfRaise(strStyleName, "strStyleName error")
End If
Dim
xhfc As
unoidl.com.sun.star.sheet.XHeaderFooterContent = Nothing
If blnHeader = True
Then
xhfc = _objPageSetupPpt(NOO.enmCalcPageSetupPpt.RightPageHeaderContent)
Else
xhfc = _objPageSetupPpt(NOO.enmCalcPageSetupPpt.RightPageFooterContent)
End If
Dim xtxt As
unoidl.com.sun.star.text.XText = Nothing
If chrPart = "r"c Then
xtxt = xhfc.getRightText
ElseIf chrPart = "c"c Then
xtxt = xhfc.getCenterText
ElseIf chrPart = "l"c Then
xtxt = xhfc.getLeftText
Else
NError.nfRaise(chrPart, "chrPart error")
End If
Dim xtc As
unoidl.com.sun.star.text.XTextCursor = xtxt.createTextCursor()
xtc.setString("")
If strData = "" Then
If blnHeader = True
Then
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.RightPageHeaderContent) = xhfc
Else
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.RightPageFooterContent) = xhfc
End If
If xhfc.getRightText.getString =
"" AndAlso _
xhfc.getLeftText.getString = "" AndAlso
_
xhfc.getCenterText.getString = "" Then
If blnHeader = True
Then
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.HeaderIsOn) = False
Else
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.FooterIsOn) = False
End If
End If
Exit Function
End If
Dim xmsf As
unoidl.com.sun.star.lang.XMultiServiceFactory = g_ndoc._doc
strData = strData.Replace("&&", vbTab)
Dim pStart As
Integer = 0
Dim px As
Integer = 0
Do
If px > strData.Length - 1 Then
Exit Do
End If
If strData.Chars(px) = "&"
Then
If px < strData.Length - 1 Then
If strData.Chars(px + 1) =
"p"c OrElse _
strData.Chars(px + 1) = "n"c OrElse
_
strData.Chars(px + 1)
= "d"c OrElse _
strData.Chars(px + 1) = "t"c OrElse
_
strData.Chars(px + 1) = "c"c OrElse
_
strData.Chars(px + 1) = "f"c OrElse
_
strData.Chars(px + 1) = "s"c OrElse
_
strData.Chars(px + 1) = "T"c Then
If px <> pStart Then
xtc.gotoEnd(False)
xtxt.insertString(xtc _
, strData.Substring(pStart, px - pStart).Replace(vbTab,
"&") _
, True _
)
xtc.gotoEnd(False)
Dim xtc1 As
unoidl.com.sun.star.text.XTextContent = Nothing
If strData.Chars(px + 1) =
"p"c Then
xtc1 = _
xmsf.createInstance("com.sun.star.text.TextField.PageNumber")
xtxt.insertTextContent(xtc, xtc1, True)
ElseIf strData.Chars(px + 1) =
"n"c Then
xtc1 = _
xmsf.createInstance("com.sun.star.text.TextField.PageCount")
xtxt.insertTextContent(xtc, xtc1, True)
ElseIf strData.Chars(px + 1) =
"d"c Then
xtc1 = _
xmsf.createInstance("com.sun.star.text.TextField.DateTime")
xtxt.insertTextContent(xtc, xtc1, True)
ElseIf strData.Chars(px + 1) =
"t"c Then
xtc1 = _
xmsf.createInstance("com.sun.star.text.TextField.Time")
'Dim ps As XPropertySet = xtcTime
'ps.setPropertyValue("IsDate", New
uno.Any(False))
xtxt.insertTextContent(xtc, xtc1, True)
ElseIf strData.Chars(px + 1) =
"c"c Then
xtxt.insertString(xtc _
, SystemInformation.ComputerName _
, True _
)
ElseIf strData.Chars(px + 1) = "f"c
Then
xtc1 = _
xmsf.createInstance("com.sun.star.text.TextField.FileName")
xtxt.insertTextContent(xtc, xtc1, True)
ElseIf strData.Chars(px + 1) =
"s"c Then
xtc1 = _
xmsf.createInstance("com.sun.star.text.TextField.SheetName")
xtxt.insertTextContent(xtc, xtc1, True)
ElseIf strData.Chars(px + 1) =
"T"c Then
xtc1 = _
xmsf.createInstance("com.sun.star.text.TextField.DocumentTitle")
xtxt.insertTextContent(xtc, xtc1, True)
End If
px
+= 2
pStart = px
Continue Do
End If
End If
End If
End If
px += 1
Loop
If px <> pStart Then
xtc.gotoEnd(False)
xtxt.insertString(xtc _
, strData.Substring(pStart, px - pStart).Replace(vbTab,
"&") _
, True _
)
End If
If blnHeader = True
Then
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.RightPageHeaderContent) = xhfc
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.HeaderIsOn) = True
Else
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.RightPageFooterContent) = xhfc
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.FooterIsOn) = True
End If
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_ndoc._doc
Dim xna As
unoidl.com.sun.star.container.XNameAccess = xfs.getStyleFamilies
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xna.getByName("PageStyles").Value
Dim xstl As
unoidl.com.sun.star.style.XStyle = xnc.getByName(strStyleName).Value
Dim nuda As
New nNOOUserDefinedAttibutes(xstl)
If blnHeader = True
Then
nuda._objAttribute("Header_" & strStyleName &
"_" & chrPart) = strData
Else
nuda._objAttribute("Footer_" & strStyleName &
"_" & chrPart) = strData
End If
'analize of content(not yet)
'If blnHeader = False OrElse chrPart <>
"r"c Then
'
Exit Property
'End If
'Dim xt As XText = xhfc.getRightText
'Dim xtfs As XTextFieldsSupplier = xt
'Dim x As XTextEmbeddedObjectsSupplier = xhfc
'Dim x As XFlatParagraphIteratorProvider =
xhfc
'Dim xna As XNameAccess =
xtfs.getTextFieldMasters()
'Dim strs1() As String = xna.getElementNames
'Dim xea As XEnumerationAccess = xtfs.getTextFields()
'Dim enm As XEnumeration =
xea.createEnumeration
'While enm.hasMoreElements
'
Dim any As uno.Any = enm.nextElement
'
Dim tf As XTextField = any.Value
'
'Dim tc As XTextContent = any.Value
' Dim xtr
As XTextRange = tf.getAnchor
'
Dim str2 As String = xtr.getString()
'
Dim str1 As String = tf.getPresentation(True)
'
'NOO.nfPropertyDisplay(any.Value)
'
Dim xsi As XServiceInfo = tf
' Dim str
As String = xsi.getImplementationName
'
Dim strs() As String = xsi.getSupportedServiceNames
'End While
'Dim xt As XText = xhfc.getRightText
'Dim xtts As XTextFieldsSupplier = xt
'Dim xna As XNameAccess = xtts.getTextFields()
'Dim strEles() As String = xna.getElementNames
'For p1 As Integer = 0 To strEles.Length - 1
'
Dim a As uno.Any = xna.getByName(strEles(p1))
'Next
'Dim xi As XIndexAccess = xea
'For p1 As Integer = 0 To xi.getCount - 1
'
Dim any As uno.Any = xi.getByIndex(p1)
'
Dim xtf As XTextField = any.Value
'Next
'Dim xtc1 As XTextCursor =
xhfc.getRightText.createTextCursor
'xtc1.gotoStart(False)
'xtc1.goRight(12, True)
'Dim xtx As XText = xtc1.getText
'Dim str As String = xtc1.getString
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>
''' PrinterPaperTray ex)Default
''' </summary>
<Browsable(False)> _
Public Property
_strPrinterPaperTray _
(Optional ByVal
strStyleName As String
= "" _
) As String
Get
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
Return
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.PrinterPaperTray _
, strStyleName _
)
End Get
Set(ByVal Value As String)
Try
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.PrinterPaperTray, strStyleName)
= Value
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' PaperSizeName(set after add Sheet) A4,A5
''' </summary>
<Browsable(False)> _
Public Property
_enmPaperSizeName _
(Optional ByVal
strStyleName As String
= "" _
) As NOO.enmPaperSizeName
Get
' due to Bug XPrintable is unavaliable
'Dim xpb As XPrintable = g_doc
'Dim pvs() As PropertyValue = xpb.getPrinter
'Dim pf As PaperFormat = 0
'For p1 As Integer = 0 To pvs.Length - 1
'
If pvs(p1).Name = "PaperFormat" Then
' pf =
pvs(p1).Value.Value
'
NSS.nfDW(pf.ToString, "PaperFormat")
'
End If
'
If pvs(p1).Name = "PaperSize" Then
'
NSS.nfDW(NOO.nfToDrawingSize(pvs(p1).Value.Value),
"PaperSize")
'
NSS.nfDW(NOO.nfToDrawingSize(_PageSetupProperty(NOO.CalcPageSetupPpt.Size)))
'
End If
'Next
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
Dim sizf As
SizeF = _
NOO.nfToDrawingSize(_objPageSetupPpt(NOO.enmCalcPageSetupPpt.Size,
strStyleName))
If _enmPageOrientation =
NOO.enmPageOrientation.Landscape Then
sizf = New Size(sizf.Height, sizf.Width)
End If
For p1 As
Integer = 0 To
NOO.strPaperMMs.Length - 1
Dim strs() As
String = NStr.nfSplit(NOO.strPaperMMs(p1) _
, " *" _
, Nothing _
, _
, 3 _
)
'compare under 1mm
If Math.Abs(strs(1) - sizf.Width / 100) < 1 AndAlso _
Math.Abs(strs(2) - sizf.Height / 100) < 1 Then
Return p1
End If
Next
Return NOO.enmPaperSizeName.User
End Get
Set(ByVal Value As NOO.enmPaperSizeName)
Try
'Dim xpb As XPrintable = g_doc
'Dim pvs() As PropertyValue = xpb.getPrinter
'For p1 As Integer = 0 To pvs.Length - 1
'
If pvs(p1).Name = "CanSetPaperFormat" Then
' If
pvs(p1).Value.Value = False Then
'
NError.nfRaise("", "CanSetPaperFormat=false error")
' End If
'
End If
'Next
'For p1 As Integer = 0 To pvs.Length - 1
' If
pvs(p1).Name = "PaperFormat" Then
' 'pvs(p1).Value =
New uno.Any(GetType(PaperFormat), Value)
' 'ElseIf
pvs(p1).Name = "PaperSize" Then
' ' If Value = NOO.PaperFormat.USER
Then
'
' pvs(p1).Value =
New uno.Any(GetType(unoidl.com.sun.star.awt.Size) _
' '
, NOO.nfToawtSize(New Size(100, 200)) _
' '
)
' ' End If
'
End If
'Next
'xpb.setPrinter(pvs)
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
For p1 As
Integer = 0 To
NOO.strPaperMMs.Length - 1
Dim strs() As
String = NStr.nfSplit(NOO.strPaperMMs(p1) _
, " *" _
, Nothing _
, _
,
3 _
)
If NStr.nfCompare(strs(0),
Value.ToString) = 0 Then
If _enmPageOrientation =
NOO.enmPageOrientation.Portrait Then
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.Size, strStyleName) = _
New
unoidl.com.sun.star.awt.Size(NSS.nfCInt(strs(1)) * 100 _
, NSS.nfCInt(strs(2)) * 100 _
)
Else
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.Size, strStyleName) = _
New
unoidl.com.sun.star.awt.Size(NSS.nfCInt(strs(2)) * 100 _
,
NSS.nfCInt(strs(1)) * 100 _
)
End If
Exit Property
End If
Next
NError.nfRaise(Value, "NOO.PaperSizeName error")
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' PaperSize(set after add Sheet)
''' </summary>
<Browsable(False)> _
Public Property
_sizPaperSize _
(Optional ByVal
strStyleName As String
= "" _
) As Size
Get
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
Return
NOO.nfToDrawingSize(_objPageSetupPpt(NOO.enmCalcPageSetupPpt.Size,
strStyleName))
End Get
Set(ByVal Value As Size)
Try
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.Size, strStyleName) = _
NOO.nfToawtSize(Value)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' PageOrientation(set after add Sheet)
''' </summary>
<Browsable(False)> _
Public Property
_enmPageOrientation _
(Optional ByVal
strStyleName As String
= "" _
) As NOO.enmPageOrientation
Get
''XPrintable is unavailable
'Dim xpb As XPrintable = g_doc
'Dim pvs() As PropertyValue = xpb.getPrinter
'For p1 As Integer = 0 To pvs.Length - 1
'
If pvs(p1).Name = "PaperOrientation" Then
' Dim po As
PaperOrientation = pvs(p1).Value.Value
' Return po
'
End If
'Next
If
strStyleName = "" Then
strStyleName = _strPageStyle
End If
Dim sizf As
SizeF = _
NOO.nfToDrawingSize(_objPageSetupPpt(NOO.enmCalcPageSetupPpt.Size,
strStyleName))
If sizf.Width > sizf.Height Then
Return NOO.enmPageOrientation.Landscape
Else
Return NOO.enmPageOrientation.Portrait
End If
End Get
Set(ByVal Value As NOO.enmPageOrientation)
Try
If strStyleName = "" Then
strStyleName =
_strPageStyle
End If
Dim nprinter As
New nNOOPrinter(g_ndoc._doc)
nprinter.nfSetPageOrientation(Value)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' Left margin
''' </summary>
''' <param
name="blnInch">true=inch false=mm</param>
<Browsable(False)> _
Public Property
_sngLeftMargin _
(Optional ByVal
blnInch As Boolean
= False _
, Optional ByVal
strStyleName As String
= "" _
) As Single
Get
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
Dim sng As
Single =
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.LeftMargin _
,
strStyleName _
) / 100
If blnInch = True
Then
Return sng / 25.4
Else
Return sng
End If
End Get
Set(ByVal Value As Single)
Try
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
If blnInch = True
Then
Value = Value * 25.4
End If
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.LeftMargin, strStyleName) = _
Convert.ToInt32(Value * 100)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' RightMargin
''' </summary>
''' <param
name="blnInch">true=inch false=mm</param>
<Browsable(False)> _
Public Property
_sngRightMargin _
(Optional ByVal
blnInch As Boolean
= False _
, Optional ByVal
strStyleName As String
= "" _
) As Single
Get
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
Dim sng As
Single =
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.RightMargin, strStyleName) / 100
If blnInch = True
Then
Return sng / 25.4
Else
Return sng
End If
End Get
Set(ByVal Value As Single)
Try
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
If blnInch = True
Then
Value = Value * 25.4
End If
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.RightMargin, strStyleName) = _
Convert.ToInt32(Value * 100)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' TopMargin
''' </summary>
''' <param
name="blnInch">true=inch false=mm</param>
<Browsable(False)> _
Public Property
_sngTopMargin _
(Optional ByVal
blnInch As Boolean
= False _
, Optional ByVal
strStyleName As String
= "" _
) As Single
Get
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
Dim sng As
Single =
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.TopMargin, strStyleName) / 100
If blnInch = True
Then
Return sng / 25.4
Else
Return sng
End If
End Get
Set(ByVal Value As Single)
Try
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
If blnInch = True
Then
Value = Value * 25.4
End If
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.TopMargin, strStyleName) = _
Convert.ToInt32(Value * 100)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' BottomMargin
''' </summary>
''' <param
name="blnInch">true=inch false=mm</param>
<Browsable(False)> _
Public Property
_sngBottomMargin _
(Optional ByVal
blnInch As Boolean
= False _
, Optional ByVal
strStyleName As String
= "" _
) As Single
Get
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
Dim sng As
Single =
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.BottomMargin, strStyleName) / 100
If blnInch = True
Then
Return sng / 25.4
Else
Return sng
End If
End Get
Set(ByVal Value As Single)
Try
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
If blnInch = True
Then
Value = Value * 25.4
End If
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.BottomMargin, strStyleName) = _
Convert.ToInt32(Value * 100)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' HeaderMargin
''' </summary>
''' <param
name="blnInch">true=inch false=mm</param>
<Browsable(False)> _
Public Property
_sngHeaderMargin _
(Optional ByVal
blnInch As Boolean
= False _
, Optional ByVal
strStyleName As String
= "" _
) As Single
Get
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
Dim sng As
Single =
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.HeaderTopBorderDistance, strStyleName)
/ 100
If blnInch = True
Then
Return sng / 25.4
Else
Return sng
End If
End Get
Set(ByVal Value As Single)
Try
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
If blnInch = True
Then
Value = Value * 25.4
End If
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.HeaderTopBorderDistance,
strStyleName) = _
Convert.ToInt32(Value * 100)
Catch ex As
Exception
NError.nfShow(ex,
Err.Number)
End Try
End Set
End Property
''' <summary>
''' HeaderBodyDistance
''' </summary>
''' <param
name="blnInch">true=inch false=mm</param>
<Browsable(False)> _
Public Property
_sngHeaderBodyDistance _
(Optional ByVal
blnInch As Boolean
= False _
, Optional ByVal
strStyleName As String
= "" _
) As Single
Get
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
Dim sng As
Single = _
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.HeaderBodyDistance _
, strStyleName _
) / 100
If blnInch = True
Then
Return sng / 25.4
Else
Return sng
End If
End Get
Set(ByVal Value As Single)
Try
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
If blnInch = True
Then
Value = Value * 25.4
End If
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.HeaderBodyDistance _
, strStyleName _
) = Convert.ToInt32(Value * 100)
Catch ex As
Exception
NError.nfShow(ex,
Err.Number)
End Try
End Set
End Property
''' <summary>
''' FooterMargin
''' </summary>
''' <param
name="blnInch">true=inch false=mm</param>
<Browsable(False)> _
Public Property
_sngFooterMargin _
(Optional
ByVal blnInch As
Boolean = False
_
, Optional ByVal
strStyleName As String
= "" _
) As Single
Get
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
Dim sng As
Single = _objPageSetupPpt(NOO.enmCalcPageSetupPpt.FooterBottomBorderDistance,
strStyleName) / 100
If blnInch = True
Then
Return sng / 25.4
Else
Return sng
End If
End Get
Set(ByVal Value As Single)
Try
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
If blnInch = True
Then
Value = Value * 25.4
End If
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.FooterBottomBorderDistance,
strStyleName) = _
Convert.ToInt32(Value * 100)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' FooterBodyDistance
''' </summary>
''' <param
name="blnInch">true=inch false=mm</param>
<Browsable(False)> _
Public Property
_sngFooterBodyDistance _
(Optional ByVal
blnInch As Boolean
= False _
, Optional ByVal
strStyleName As String
= "" _
) As Single
Get
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
Dim sng As
Single = _
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.FooterBodyDistance _
, strStyleName _
)
/ 100
If blnInch = True
Then
Return sng / 25.4
Else
Return sng
End If
End Get
Set(ByVal Value As Single)
Try
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
If blnInch = True
Then
Value = Value * 25.4
End If
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.FooterBodyDistance _
, strStyleName _
) = Convert.ToInt32(Value * 100)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' PrintGridLines
''' </summary>
<Browsable(False)> _
Public Property
_blnPrintGridLines _
(Optional ByVal
strStyleName As String
= "" _
) As Boolean
Get
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
Return _objPageSetupPpt(NOO.enmCalcPageSetupPpt.PrintGrid,
strStyleName)
End Get
Set(ByVal Value As Boolean)
Try
If strStyleName = "" Then
strStyleName = _strPageStyle
End If
_objPageSetupPpt(NOO.enmCalcPageSetupPpt.PrintGrid, strStyleName) =
Value
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End Property
''' <summary>
''' nNOOCalcDoc
''' </summary>
<Browsable(False)> _
Public ReadOnly Property _ndoc _
( _
) As nNCalcDoc
Get
Return g_ndoc
End Get
End Property
End Class
3-4.nNCalcRange
Imports System.ComponentModel
Imports System.Drawing
Imports System.Text
Public Class nNCalcRange
Private
g_nsheet As nNCalcSheet
Private
g_rng As unoidl.com.sun.star.table.XCellRange
Private
g_rctRange As Rectangle = Nothing
Private
g_intNumArrays As Integer
= -1
Private
g_lstArrayRange As List(Of unoidl.com.sun.star.table.XCellRange)
Public
Sub New _
(ByVal nsheet As
nNCalcSheet _
, ByVal rng As
unoidl.com.sun.star.table.XCellRange _
)
Try
g_nsheet = nsheet
g_rng = rng
g_rctRange = fGetRangeRect(g_rng)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
End Try
End
Sub
'(achtung)
very slow
Private
Function fCheckArray _
( _
) As Integer
Try
Dim rctRange As
Rectangle = fGetRangeRect(g_rng)
g_lstArrayRange = New List(Of unoidl.com.sun.star.table.XCellRange)
Dim siz As
Size = rctRange.Size
If siz.Width * siz.Height < 2 Then
Return 1
End If
Dim mgb As
unoidl.com.sun.star.util.XMergeable = _
g_rng.getCellByPosition(0, 0)
Dim
blnMerged As Boolean
= mgb.getIsMerged
Dim sizMerged As
Size = New Size(1, 1)
If blnMerged = True
Then
Dim cur As
unoidl.com.sun.star.sheet.XSheetCellCursor = _
g_nsheet._sheet.createCursorByRange(g_rng.getCellByPosition(0, 0))
cur.collapseToMergedArea()
sizMerged = fGetRangeRect(cur).Size
End If
If sizMerged.Equals(siz) Then
Return 1
End If
'a part of merge
If sizMerged.Width > siz.Width OrElse _
sizMerged.Height > siz.Height Then
Return 0
End If
If siz.Width > sizMerged.Width AndAlso _
siz.Height > sizMerged.Height Then
Return 0
End If
'check array
Dim pX As
Integer = 0
Dim pY As
Integer = 0
Dim intNumArrays As Integer = 1
g_lstArrayRange.Add(g_rng.getCellRangeByPosition(0 _
, 0 _
,
sizMerged.Width - 1 _
, sizMerged.Height - 1 _
) _
)
Do
If siz.Width = sizMerged.Width Then
pY += sizMerged.Height
If pY = siz.Height Then
Return intNumArrays
ElseIf pY > siz.Height Then
Return 0
End If
ElseIf siz.Height = sizMerged.Height Then
pX += sizMerged.Width
If pX = siz.Width Then
Return intNumArrays
ElseIf pX > siz.Width Then
Return 0
End If
Else
NError.nfRaise("", "Logic error")
End If
mgb = g_rng.getCellByPosition(pX, pY)
If mgb.getIsMerged <> blnMerged Then
Return 0
End If
Dim sizMerged1 As
Size = New Size(1, 1)
If blnMerged = True
Then
Dim cur As
unoidl.com.sun.star.sheet.XSheetCellCursor = _
g_nsheet._sheet.createCursorByRange(g_rng.getCellByPosition(pX, pY))
cur.collapseToMergedArea()
sizMerged1 =
fGetRangeRect(cur).Size
End If
If sizMerged1.Equals(sizMerged) = False Then
Return 0
End If
Dim xcr As
unoidl.com.sun.star.table.XCellRange = _
g_rng.getCellRangeByPosition(pX _
, pY _
, pX + sizMerged1.Width - 1 _
, pY + sizMerged1.Height - 1 _
)
g_lstArrayRange.Add(xcr)
intNumArrays += 1
Loop
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' write from CSV
''' </summary>
''' <param name="strData">
''' Tab
separated value line separater is vbCrLf
''' if
first byte is NConst.vbNLf its numeric
''' </param>
''' <param
name="blnIncludeMergedCell"></param>
''' <param
name="blnExcludeSheetProtect"></param>
Public
Function nfWrite _
(ByVal strData As String _
, Optional ByVal
blnIncludeMergedCell As Boolean = False _
, Optional ByVal
blnExcludeSheetProtect As Boolean = False _
) As Boolean
Try
Dim strRows() As
String = NStr.nfSplitEx(strData, vbCrLf)
Dim lst As
New List(Of String())
For p1 As
Integer = 0 To
strRows.Length - 1
Dim strColumns() As String =
NStr.nfSplitExcel(strRows(p1))
lst.Add(strColumns)
Next
Dim
objss(lst.Count - 1)() As Object
For p1 As
Integer = 0 To
lst.Count - 1
ReDim Preserve
objss(p1)(lst(p1).Length - 1)
'if first byte is NConst.vbNLf its numeric
For p2 As
Integer = 0 To
lst(p1).Length - 1
If Mid(lst(p1)(p2), 1, 1) = NConst.vbNLfăÖ
Then
objss(p1)(p2) = NSS.nfCDbl(Mid(lst(p1)(p2), 2))
Else
objss(p1)(p2) = lst(p1)(p2)
End If
Next
Next
Return nfWriteFromArray(objss _
,
blnIncludeMergedCell _
, blnExcludeSheetProtect _
)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
WriteFromArray
''' </summary>
''' <param name="objValuess">Value</param>
''' <param
name="blnIncludeMergedCell"></param>
''' <param
name="blnExcludeSheetProtect"></param>
Public
Function nfWriteFromArray _
(ByVal objValuess()() As
Object _
, Optional ByVal
blnIncludeMergedCell As Boolean = False _
, Optional ByVal
blnExcludeSheetProtect As Boolean = False _
) As Boolean
Try
Dim blnSkipss()() As Boolean = Nothing
If blnIncludeMergedCell = False Then
blnSkipss = fCreateSkipTable()
End If
Dim lstImage As
New List(Of
g_typImage)
Dim py2 As
Integer = 0
Dim px2 As
Integer = 0
Dim objss(g_rctRange.Height - 1)() As Object
For py As
Integer = 0 To
g_rctRange.Height - 1
Dim objs(g_rctRange.Width - 1) As Object
For px As
Integer = 0 To
g_rctRange.Width - 1
If (blnSkipss Is
Nothing OrElse
_
blnSkipss(py)(px) = False) AndAlso _
py2 <= objValuess.Length - 1 AndAlso
_
px2 <= objValuess(py2).Length - 1 Then
If objValuess(py2)(px2).GetType Is GetType(String) Then
Dim str1 As
String = objValuess(py2)(px2)
'Imagefile
If
str1.StartsWith("[ImageFile]", NConst.scOrdinalIC) Then
Dim sttImage As
g_typImage = Nothing
sttImage.ipnt = New Point(g_rctRange.X +
px + 1 _
, g_rctRange.Y + py + 1 _
)
Dim strs() As
String = NStr.nfSplit(Mid(str1, 12), , , , 2)
sttImage.strFile = strs(0)
sttImage.strName = strs(1)
lstImage.Add(sttImage)
objValuess(py2)(px2) = ""
Else
'Dim rngCell As
unoidl.com.sun.star.table.XCellRange = _
'
g_rng.getCellByPosition(py2, px2)
'Dim int As Integer =
NOO._objProperty(rngCell, "NumberFormat")
'Dim xcab As
unoidl.com.sun.star.sheet.XCellAddressable = rngCell
'NSS.nfDW(int, xcab.getCellAddress.Column &
"," & xcab.getCellAddress.Row)
'current version vbLf-->vbCr
objValuess(py2)(px2) = str1.Replace(vbLf, vbCr)
End If
End If
objs(px) = objValuess(py2)(px2)
px2 += 1
Else
objs(px) = ""
End If
Next
objss(py) = objs
py2 += 1
px2 = 0
Next
'Image set
For p1 As
Integer = 0 To
lstImage.Count - 1
Dim nrng As
nNCalcRange = _
g_nsheet.nfGetRange(lstImage(p1).ipnt.Y & "," &
lstImage(p1).ipnt.X)
If
lstImage(p1).strFile.EndsWith(".ods", NConst.scOrdinalIC) Then
nrng.nfAddOLE(lstImage(p1).strFile, lstImage(p1).strName, Nothing)
Else
nrng.nfShapeDraw(lstImage(p1).strFile, lstImage(p1).strName, Nothing)
End If
Next
_objDataArray = objss
_blnLocked = Not blnExcludeSheetProtect
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
Public
Function fCreateSkipTable _
( _
) As Boolean()()
Try
Dim blnSkipss(g_rctRange.Height - 1)() As Boolean
For py As
Integer = 0 To
g_rctRange.Height - 1
ReDim blnSkipss(py)(g_rctRange.Width -
1)
Next
For py As
Integer = 0 To
blnSkipss.Length - 1
For px As
Integer = 0 To
blnSkipss(py).Length - 1
If blnSkipss(py)(px) = False Then
'get error
'Dim mgbcell As
unoidl.com.sun.star.table.XMergeableCell = _
'
g_rng.getCellByPosition(px, py)
'Dim bln As Boolean = mgbcell.isMerged
Dim cur As
unoidl.com.sun.star.sheet.XSheetCellCursor = _
g_nsheet._sheet.createCursorByRange(g_rng.getCellByPosition(px, py))
cur.collapseToMergedArea()
Dim rct As
Rectangle = fGetRangeRect(cur)
If rct.Width > 1 OrElse _
rct.Height > 1 Then
'LeftTop is not Skiped
For py1 As Integer = rct.Y To
rct.Bottom - 1
For px1 As
Integer = rct.X To
rct.Right - 1
If py1 = rct.Y AndAlso
_
px1 = rct.X Then
Continue For
End If
If py1 >= g_rctRange.Y AndAlso _
py1 <= g_rctRange.Bottom - 1 AndAlso
_
px1 >= g_rctRange.X AndAlso _
px1
<= g_rctRange.Right - 1 Then
blnSkipss(py1 - g_rctRange.Y)(px1 - g_rctRange.X) = True
End If
Next
Next
End If
End If
Next
Next
Return blnSkipss
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>Read into
TSV
'''
[return]string
''' when
error@String(error
content)
''' </summary>
''' <param
name="blnIncludeMergedCell"></param>
Public
Function nfRead _
(Optional ByVal
blnIncludeMergedCell As Boolean = False _
) As String
Try
Dim objValss()() As Object = nfReadToArray(blnIncludeMergedCell)
Dim lst As
New List(Of String)
For p1 As
Integer = 0 To
objValss.Length - 1
Dim strItems(objValss(p1).Length - 1) As String
For p2 As
Integer = 0 To
objValss(p1).Length - 1
strItems(p2) =
objValss(p1)(p2)
Next
lst.Add(NStr.nfJoinExcel(strItems))
Next
Return NStr.nfJoin(lst.ToArray, vbCrLf, Nothing)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>Read to
array
'''
[return]Object()()
''' when
error@String(error
content)
''' </summary>
Public
Function nfReadToArray _
(Optional ByVal
blnIncludeMergedCell As Boolean = False _
) As Object()()
Try
Dim objValss()() As Object = _objDataArray
If blnIncludeMergedCell = False Then
Dim blnSkipss()() As Boolean =
fCreateSkipTable()
Dim lstobjs As
New List(Of Object())
For py As
Integer = 0 To
objValss.Length - 1
Dim lstobj As
New List(Of Object)
For px As Integer = 0 To
objValss(py).Length - 1
If blnSkipss(py)(px) = False Then
lstobj.Add(objValss(py)(px))
End If
Next
If lstobj.Count <> 0 Then
lstobjs.Add(lstobj.ToArray)
End If
Next
objValss = lstobjs.ToArray
End If
For py As
Integer = 0 To
objValss.Length - 1
For px As
Integer = 0 To
objValss(py).Length - 1
If objValss(py)(px) Is Nothing Then
objValss(py)(px) = ""
End If
Next
Next
Return objValss
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
Private
Function fGetRangeRect _
(ByVal rng As
unoidl.com.sun.star.table.XCellRange _
) As Rectangle
Try
Dim xrab As
unoidl.com.sun.star.sheet.XCellRangeAddressable = rng
Dim ra As
unoidl.com.sun.star.table.CellRangeAddress = xrab.getRangeAddress
Return New
Rectangle(ra.StartColumn _
, ra.StartRow _
, ra.EndColumn - ra.StartColumn + 1 _
, ra.EndRow - ra.StartRow + 1 _
)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Clear
''' </summary>
''' <param name="blnVALUE">numeric except date,time</param>
''' <param name="blnDATETIME">date,time</param>
''' <param name="blnSTRING">string</param>
''' <param name="blnOBJECTS">cell drawing object</param>
''' <param name="blnANNOTATION">comment of cell</param>
''' <param name="blnFORMULA">formula</param>
''' <param name="blnHARDATTR">direct asign format</param>
''' <param name="blnSTYLES">indirect asign format</param>
''' <param name="blnEDITATTR">part of format</param>
Public
Function nfClear _
(Optional ByVal
blnVALUE As Boolean
= True _
, Optional ByVal
blnDATETIME As Boolean
= True _
, Optional ByVal
blnSTRING As Boolean
= True _
, Optional ByVal
blnOBJECTS As Boolean
= True _
, Optional ByVal
blnANNOTATION As Boolean
= True _
, Optional ByVal
blnFORMULA As Boolean
= True _
, Optional ByVal
blnHARDATTR As Boolean
= False _
, Optional ByVal
blnSTYLES As Boolean
= False _
, Optional ByVal
blnEDITATTR As Boolean
= False _
) As Boolean
Try
Dim xso As
unoidl.com.sun.star.sheet.XSheetOperation = _Range
Dim intFlags As
Integer = 0
If blnVALUE = True
Then
intFlags = intFlags Or &H1
End If
If blnDATETIME = True Then
intFlags = intFlags Or &H2
End
If
If blnSTRING = True
Then
intFlags = intFlags Or &H4
End If
If blnANNOTATION = True Then
intFlags = intFlags Or &H8
End If
If blnFORMULA = True
Then
intFlags = intFlags Or &H10
End If
If blnHARDATTR = True Then
intFlags = intFlags Or &H20
End If
If blnSTYLES = True
Then
intFlags = intFlags Or &H40
End If
If blnOBJECTS = True
Then
intFlags = intFlags Or &H80
End If
If blnEDITATTR = True Then
intFlags = intFlags Or &H100
End If
xso.clearContents(intFlags)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
DrawShape
''' </summary>
''' <param name="strFileName">FileName ex)c:\aaa.bmp only Name is from DocFolder</param>
''' <param name="strName">Name</param>
''' <param name="siz">Empty=raw size 1/100mm</param>
''' <param name="blnLink">true=Link false=embed</param>
Public
Function nfShapeDraw _
(ByVal strFileName As String _
, ByVal strName As String _
, ByVal siz As Size _
, Optional ByVal
blnLink As Boolean
= False _
) As Boolean
Try
If NIO.nfFileExists(strFileName)
<> "" Then
strFileName = NIO.nfGetParentFolder(g_nsheet._ndoc._strDocFile)
Dim strFileName2 As String = NIO.nfGetParentFolder(g_nsheet._ndoc._strDocFile)
If strFileName2.EndsWith("\") Then
strFileName = strFileName2 & strFileName
Else
strFileName = strFileName2 & "\" & strFileName
End If
If NIO.nfFileExists(strFileName)
<> "" Then
NError.nfRaise(strFileName, "strFileName error")
End If
End If
'NOO.nfPropertyDisplay(_Range)
'Dim pnt1 As unoidl.com.sun.star.awt.Point =
_objProperty(NOO.RangePpt.Position)
Dim ngr As
New nNOOGraphic(g_nsheet._ndoc.g_ncalc _
, strFileName _
)
Dim xmsf As
unoidl.com.sun.star.lang.XMultiServiceFactory = _
g_nsheet._ndoc._doc
Dim xshp As
unoidl.com.sun.star.drawing.XShape = _
xmsf.createInstance("com.sun.star.drawing.GraphicObjectShape")
xshp.setPosition(_objProperty(NOO.enmCalcRangePpt.Position)) '0.01mm
If siz.IsEmpty = True Then
xshp.setSize(ngr._awtsiz100thMM)
Else
xshp.setSize(NOO.nfToawtSize(siz))
End If
If blnLink = True
Then
NOO._objProperty(xshp, "GraphicURL") = _
NIO.nfFilePathToFileURL(strFileName)
'error on Save
'NOO._objProperty(xshp,
"GraphicURL") = strFileName
Else
NOO._objProperty(xshp, "Graphic") = ngr._Graphic
End If
'EMF is hemming
If
strFileName.EndsWith(".emf", NConst.scOrdinalIC) Then
NOO._objProperty(xshp, "LineStyle") =
unoidl.com.sun.star.drawing.LineStyle.SOLID
NOO._objProperty(xshp, "LineWidth") = 2
NOO._objProperty(xshp, "LineColor") =
SystemColors.Control.ToArgb
End If
Dim xnamed As
unoidl.com.sun.star.container.XNamed = xshp
xnamed.setName(strName)
Dim xdps As
unoidl.com.sun.star.drawing.XDrawPageSupplier = g_nsheet._sheet
Dim xdp As
unoidl.com.sun.star.drawing.XDrawPage = xdps.getDrawPage
xdp.add(xshp)
'NOO.nfPropertyDisplay(xshp)
''attributeData=ImageFile set
'Dim cell As unoidl.com.sun.star.table.XCell =
_Range.getCellByPosition(0, 0)
'Dim nuda As New
nNOOUserDefinedAttibutes(cell)
'nuda._objAttribute("ImageFile")
= strFileName
''Dim strs() As String = nuda.nfGetNames
''Dim str As String =
nuda._Attribute("aa")
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' add
OLE
'''
[caution]to distinct background use BackColor. cant use frame of OLE shape
''' </summary>
''' <param name="strFileName">FileName</param>
''' <param name="strName">Name</param>
''' <param name="siz">Empty=raw size 1/100mm</param>
''' <param name="blnLink">true=Link false=embed</param>
Public
Function nfAddOLE _
(ByVal strFileName As String _
, ByVal strName As String _
, ByVal siz As Size _
, Optional ByVal
blnLink As Boolean
= False _
) As Boolean
Try
If NIO.nfFileExists(strFileName)
<> "" Then
strFileName = NIO.nfGetParentFolder(g_nsheet._ndoc._strDocFile) _
& "\" & strFileName
If NIO.nfFileExists(strFileName) <>
"" Then
NError.nfRaise(strFileName, "strFileName error")
End If
End If
Dim xmsf As
unoidl.com.sun.star.lang.XMultiServiceFactory = g_nsheet._ndoc._doc
Dim xshp As
unoidl.com.sun.star.drawing.XShape = _
xmsf.createInstance("com.sun.star.drawing.OLE2Shape")
Dim xdps As
unoidl.com.sun.star.drawing.XDrawPageSupplier = g_nsheet._sheet
Dim xdp As
unoidl.com.sun.star.drawing.XDrawPage = xdps.getDrawPage
xdp.add(xshp)
xshp.setPosition(_objProperty(NOO.enmCalcRangePpt.Position)) '0.01mm
xshp.setSize(New
unoidl.com.sun.star.awt.Size(0, 0))
If blnLink = True
Then
'OLE2 of excel link????
NOO._objProperty(xshp,
"LinkURL") = NIO.nfFilePathToFileURL(strFileName)
If siz.IsEmpty = True Then
'g_nsheet._ndoc.nfActionLock(False)
'g_nsheet._ndoc._blnVisible = True
'g_nsheet._ndoc.nfSelect(xshp)
Dim sizOriginal As
unoidl.com.sun.star.awt.Size = _
NOO._objProperty(xshp, "OriginalSize")
xshp.setSize(sizOriginal)
'g_nsheet._ndoc._blnVisible = False
'g_nsheet._ndoc.nfActionLock(True)
Else
xshp.setSize(NOO.nfToawtSize(siz))
End If
Else
'''''Embed
If
strFileName.EndsWith(".ods", NConst.scOrdinalIC) OrElse _
strFileName.EndsWith(".xls", NConst.scOrdinalIC) Then
NOO._objProperty(xshp, "CLSID") =
"47bbb4cb-ce4c-4e80-a591-42d9ae74950f"
ElseIf
strFileName.EndsWith(".odt", NConst.scOrdinalIC) Then
NOO._objProperty(xshp, "CLSID") = "8bc6b165-b1b2-4edd-aa47-dae2ee689dd6"
Else
NError.nfRaise(strFileName, "OLE kind error")
End If
Dim xmdl As
unoidl.com.sun.star.frame.XModel = _
NOO._objProperty(xshp, "Model")
'way of exchange current controller
xmdl.setCurrentController(g_nsheet._ndoc._CurrentController)
Dim docEmbeded As
unoidl.com.sun.star.sheet.XSpreadsheetDocument = xmdl
'g_nsheet.g_ndoc.nfSelect(xshp)
Dim ndocEmbeded As
New nNCalcDoc(g_nsheet._ndoc.g_ncalc _
, docEmbeded _
, "" _
, False _
)
ndocEmbeded.fAllSheetCopy(strFileName)
If siz.IsEmpty = True Then
Dim nsheet As
nNCalcSheet = ndocEmbeded.nfGetSheet(1)
Dim pnt As
Point = nsheet.nfGetMaxUsedPoint
Dim nrng1 As
nNCalcRange = _
nsheet.nfGetRange(pnt.Y
+ 1 & "," & pnt.X + 1)
Dim pntAwt As
unoidl.com.sun.star.awt.Point = _
nrng1._objProperty(NOO.enmCalcRangePpt.Position)
NOO._objProperty(xshp, "VisibleArea") = _
New unoidl.com.sun.star.awt.Rectangle(0, 0, pntAwt.X,
pntAwt.Y)
xshp.setSize(New
unoidl.com.sun.star.awt.Size(pntAwt.X, pntAwt.Y))
Else
xshp.setSize(NOO.nfToawtSize(siz))
End If
End If
Dim xnamed As
unoidl.com.sun.star.container.XNamed = xshp
xnamed.setName(strName)
'NOO.nfPropertyDisplay(xshp)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' set
Format
''' </summary>
''' <param name="objFormat">NOO.enmFormat or #,##0</param>
Public
Function nfSetFormat _
(ByVal objFormat As Object _
) As Boolean
Dim c_strFormat As String = ""
Try
Dim xnfs As
unoidl.com.sun.star.util.XNumberFormatsSupplier = _
g_nsheet._ndoc._doc
Dim intKey As
Integer = 0
If objFormat.GetType Is GetType(NOO.enmFormat)
Then
Dim lc As
New unoidl.com.sun.star.lang.Locale
Dim xnfts As
unoidl.com.sun.star.util.XNumberFormatTypes = _
xnfs.getNumberFormats
intKey = xnfts.getStandardFormat(objFormat, lc)
Else
Dim strFormat As
String = objFormat
If Mid(strFormat, 1, 2) = "n." Then
strFormat = Mid(strFormat, 3)
End If
Dim xnf As
unoidl.com.sun.star.util.XNumberFormats = _
xnfs.getNumberFormats
If strFormat.Contains("/") Then
Dim lc As
New unoidl.com.sun.star.lang.Locale
If strFormat = "0000/00" Then
strFormat = "YYYY/MM"
ElseIf strFormat =
"0000/00/00" Then
strFormat = "YYYY/MM/DD"
ElseIf
strFormat = "00/00/00" Then
strFormat = "YY/MM/DD"
lc.Language = "en"
'England
lc.Country = "GB"
'lc.Language = "ja"
'lc.Country = "JP"
ElseIf strFormat = "00/00" Then
strFormat = "YY/MM"
End If
intKey = xnf.queryKey(strFormat, lc, False)
If intKey = -1 Then
c_strFormat = strFormat
intKey = xnf.addNew(strFormat, lc)
End If
Else
Dim lc As
New unoidl.com.sun.star.lang.Locale
intKey = xnf.queryKey(strFormat, lc, False)
If intKey = -1 Then
intKey = xnf.addNew(strFormat, lc)
'lc.Language = "ja"
'lc.Country = "JP"
End If
End If
End If
_objProperty(NOO.enmCalcRangePpt.NumberFormat) = intKey
Return True
Catch ex As Exception
NSS.nfDW(c_strFormat, "")
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Merged
''' </summary>
<Browsable(False)> _
Public
Property _blnMerged _
( _
) As Boolean
Get
Dim mgb As
unoidl.com.sun.star.util.XMergeable = g_rng
Return mgb.getIsMerged
End Get
Set(ByVal value As Boolean)
Dim mgb As
unoidl.com.sun.star.util.XMergeable = g_rng
mgb.merge(value)
End Set
End
Property
''' <summary>
'''
RangeAddress left,top,right,bottom
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_strRangeAddress _
( _
) As String
Get
Dim strAddress As
String = g_rctRange.Left & ","
& g_rctRange.Top
If g_rctRange.Width <> 1 OrElse _
g_rctRange.Height <> 1 Then
strAddress &= ":" & (g_rctRange.Right - 1) &
"," & (g_rctRange.Bottom - 1)
End If
Return strAddress
End Get
End
Property
''' <summary>
'''
RangeAddress An:Bn
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_strRangeAddressAn _
( _
) As String
Get
Dim strAddress As
String = NOffice.nfNOToColumn(g_rctRange.Left +
1) _
& (g_rctRange.Top + 1)
If g_rctRange.Width <> 1 OrElse _
g_rctRange.Height <> 1 Then
strAddress &= ":" &
NOffice.nfNOToColumn(g_rctRange.Right) & (g_rctRange.Bottom)
End If
Return strAddress
End Get
End
Property
''' <summary>
'''
RangeName SheetName.An
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_strRangeName _
( _
) As String
Get
Return
_objProperty(NOO.enmCalcRangePpt.AbsoluteName).ToString.Replace("$",
"")
End Get
End
Property
''' <summary>
'''
AbsoluteName $SheetName.$A$1
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_strAbsoluteName _
( _
) As String
Get
Return
_objProperty(NOO.enmCalcRangePpt.AbsoluteName).ToString
End Get
End
Property
''' <summary>
'''
Range rectangle
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_rctRange _
( _
) As Rectangle
Get
Return g_rctRange
End Get
End
Property
''' <summary>
''' num
Cells
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_intNumCells _
( _
) As Integer
Get
Return g_rctRange.Width *
g_rctRange.Height
End Get
End
Property
''' <summary>
'''
NumArrays numarrays > 1
'''
[exp]array should lineup 1line
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_intNumArrays _
( _
) As Integer
Get
If g_intNumArrays = -1 Then
g_intNumArrays = fCheckArray()
End If
Return g_intNumArrays
End Get
End
Property
''' <summary>
''' Name
'''
[exp]when Set null=remove Name
''' </summary>
'''<param name="blnWithoutOverlapCheck">use when set</param>
<Browsable(False)> _
Public
Property _strName _
(Optional ByVal
blnWithoutOverlapCheck As Boolean = False _
) As String
Get
Dim strRangeNames() As String =
g_nsheet.nfGetRangeNames
For p1 As
Integer = 0 To
strRangeNames.Length - 1
Dim xrng As
unoidl.com.sun.star.table.XCellRange = _
g_nsheet._sheet.getCellRangeByName(strRangeNames(p1))
Dim rct As Rectangle
= fGetRangeRect(xrng)
If rct.Equals(_rctRange) Then
Return strRangeNames(p1)
End If
Next
Return ""
End Get
Set(ByVal Value As String)
'Remove
If Value = "" AndAlso _
_strName <> "" Then
Dim xnrs2 As
unoidl.com.sun.star.sheet.XNamedRanges = _
g_nsheet._ndoc._objProperty(NOO.enmCalcDocPpt.NamedRanges)
xnrs2.removeByName(_strName)
Exit Property
End If
Dim xnrs As
unoidl.com.sun.star.sheet.XNamedRanges = _
g_nsheet._ndoc._objProperty(NOO.enmCalcDocPpt.NamedRanges)
If blnWithoutOverlapCheck = False AndAlso _
xnrs.hasByName(Value) = True Then
Exit Property
''cant use xnrs.getByName
''Dim xcr As Object = xnrs.getByName(Value)
'Dim xia As XIndexAccess = xnrs
'For p1 As Integer = 0 To xia.getCount - 1
'
Dim xnr As XNamedRange = xia.getByIndex(p1).Value
'
Dim strName As String = xnr.getName
'
If NStr.nfCompare(strName, Value) = 0 Then
' Dim xcr As
XCellRange = g_nsheet._Sheet.getCellRangeByName(strName)
' If _rctRange.Equals(fGetRangeRect(xcr))
Then
'
Exit Property
' Else
'
NError.nfRaise(Value, "RangeName overlaped")
' End If
'
End If
'Next
End If
Dim ca As
New unoidl.com.sun.star.table.CellAddress
xnrs.addNewByName(Value _
, _objProperty(NOO.enmCalcRangePpt.AbsoluteName).ToString _
, ca _
, 0 _
)
End Set
End
Property
''' <summary>
'''
Comment should set after text set
''' </summary>
<Browsable(False)> _
Public
Property _strComment _
( _
) As String
Get
Dim xcell As
unoidl.com.sun.star.table.XCell = g_rng.getCellByPosition(0, 0)
Dim xaa As
unoidl.com.sun.star.sheet.XSheetAnnotationAnchor = xcell
Dim xsa As
unoidl.com.sun.star.sheet.XSheetAnnotation = xaa.getAnnotation
Dim xst As
unoidl.com.sun.star.text.XSimpleText = xsa
Return xst.getString
End Get
Set(ByVal value As String)
Dim xsas As
unoidl.com.sun.star.sheet.XSheetAnnotationsSupplier = _
g_nsheet._sheet
Dim xsans As
unoidl.com.sun.star.sheet.XSheetAnnotations = xsas.getAnnotations()
Dim xcab As
unoidl.com.sun.star.sheet.XCellAddressable = g_rng.getCellByPosition(0, 0)
'remove
If value = "" Then
For p1 As
Integer = 0 To
xsans.getCount - 1
Dim xsa As
unoidl.com.sun.star.sheet.XSheetAnnotation = xsans.getByIndex(p1).Value
If xsa.getPosition.Column =
xcab.getCellAddress.Column AndAlso _
xsa.getPosition.Row = xcab.getCellAddress.Row Then
xsans.removeByIndex(p1)
Exit For
End If
Next
'add
Else
xsans.insertNew(xcab.getCellAddress, value)
End If
End Set
End
Property
''' <summary>
'''
Format
''' </summary>
''' <param name="strFormat">special Format</param>
<Browsable(False)> _
Public
ReadOnly Property
_enmFormat _
(Optional ByVal
strFormat As String
= "" _
) As NOO.enmFormat
Get
Return
_objProperty(NOO.enmCalcRangePpt.NumberFormat)
End Get
End
Property
''' <summary>
'''
range Font
''' </summary>
<Browsable(False)> _
Public
Property _fntFont _
( _
) As Font
Get
Dim strFamilyName As String =
_objProperty(NOO.enmCalcRangePpt.CharFontNameAsian)
Dim sngSize As
Single =
_objProperty(NOO.enmCalcRangePpt.CharHeight)
Dim strStyle As
String =
_objProperty(NOO.enmCalcRangePpt.CharFontStyleNameAsian)
Dim fs As
FontStyle = Nothing
If InStr(strStyle, "bold", CompareMethod.Text)
<> 0 Then
fs = fs Or FontStyle.Bold
End If
If InStr(strStyle, "italic",
CompareMethod.Text) <> 0 Then
fs = fs Or FontStyle.Italic
End If
If
_objProperty(NOO.enmCalcRangePpt.CharStrikeout) <> 0 Then
fs = fs Or FontStyle.Strikeout
End If
If
_objProperty(NOO.enmCalcRangePpt.CharUnderline) <> 0 Then
fs = fs Or FontStyle.Underline
End If
Return New
Font(strFamilyName, sngSize, fs)
End Get
Set(ByVal Value As Font)
Try
_objProperty(NOO.enmCalcRangePpt.CharFontName) = Value.FontFamily.Name
_objProperty(NOO.enmCalcRangePpt.CharFontNameAsian) =
Value.FontFamily.Name
_objProperty(NOO.enmCalcRangePpt.CharHeight) = Value.Size
_objProperty(NOO.enmCalcRangePpt.CharHeightAsian) = Value.Size
Dim strStyle As
String = ""
If Value.Bold = True
Then
strStyle = "Bold"
End If
If Value.Italic = True
Then
If strStyle <> "" Then
strStyle &= " "
End If
strStyle = "Italic"
End If
If strStyle <> "" Then
_objProperty(NOO.enmCalcRangePpt.CharFontStyleNameAsian) = strStyle
End If
If Value.Strikeout = True Then
_objProperty(NOO.enmCalcRangePpt.CharStrikeout) = _
NSS.nfCInt(NOO.enmFontStrikeout.SINGLE)
End If
If Value.Underline = True Then
_objProperty(NOO.enmCalcRangePpt.CharUnderline) = _
NSS.nfCInt(NOO.enmFontUnderline.SINGLE)
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
range FontName
''' </summary>
<Browsable(False)> _
Public
Property _strFontName _
( _
) As String
Get
Return
_objProperty(NOO.enmCalcRangePpt.CharFontNameAsian)
End Get
Set(ByVal value As String)
Try
If value <> "" Then
_objProperty(NOO.enmCalcRangePpt.CharFontName) = value
_objProperty(NOO.enmCalcRangePpt.CharFontNameAsian) = value
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
range FontSize(point)
''' </summary>
<Browsable(False)> _
Public
Property _sngFontSize _
( _
) As Single
Get
Return
_objProperty(NOO.enmCalcRangePpt.CharHeight)
End Get
Set(ByVal value As Single)
If value <> 0 Then
_objProperty(NOO.enmCalcRangePpt.CharHeight) = value
_objProperty(NOO.enmCalcRangePpt.CharHeightAsian) = value
End If
End Set
End
Property
''' <summary>
'''
range FontStyle ex)Italic Bold Strikeout Underline
''' </summary>
<Browsable(False)> _
Public
Property _strFontStyle _
( _
) As String
Get
Dim strStyle As
String = ""
If
_objProperty(NOO.enmCalcRangePpt.CharPosture) = _
unoidl.com.sun.star.awt.FontSlant.ITALIC Then
If strStyle <> "" Then
strStyle &= " "
End If
strStyle &= "Italic"
End If
If
_objProperty(NOO.enmCalcRangePpt.CharWeight) > 100 Then
If strStyle <> "" Then
strStyle &= " "
End If
strStyle &= "Bold"
End If
If
_objProperty(NOO.enmCalcRangePpt.CharStrikeout) <> 0 Then
If strStyle <> "" Then
strStyle &= " "
End If
strStyle &= "Strikeout"
End If
If _objProperty(NOO.enmCalcRangePpt.CharUnderline)
<> 0 Then
If strStyle <> "" Then
strStyle &= " "
End If
strStyle &= "Underline"
End If
Return strStyle
End Get
Set(ByVal value As String)
Try
If InStr(value, "strikeout",
CompareMethod.Text) <> 0 Then
_objProperty(NOO.enmCalcRangePpt.CharStrikeout) = _
NSS.nfCInt(NOO.enmFontStrikeout.SINGLE)
value = NStr.nfReplace(value, "strikeout", "")
Else
_objProperty(NOO.enmCalcRangePpt.CharStrikeout) = _
NSS.nfCInt(NOO.enmFontStrikeout.NONE)
End If
If InStr(value, "underline",
CompareMethod.Text) <> 0 Then
_objProperty(NOO.enmCalcRangePpt.CharUnderline)
= _
NSS.nfCInt(NOO.enmFontUnderline.SINGLE)
value = NStr.nfReplace(value, "underline", "")
Else
_objProperty(NOO.enmCalcRangePpt.CharUnderline) = _
NSS.nfCInt(NOO.enmFontUnderline.NONE)
End If
If InStr(value, "bold",
CompareMethod.Text) <> 0 Then
_objProperty(NOO.enmCalcRangePpt.CharWeight) = 200
_objProperty(NOO.enmCalcRangePpt.CharWeightAsian) = 200
value = NStr.nfReplace(value, "bold", "")
Else
_objProperty(NOO.enmCalcRangePpt.CharWeight) = 100
_objProperty(NOO.enmCalcRangePpt.CharWeightAsian) = 100
End If
If InStr(value, "Italic",
CompareMethod.Text) <> 0 Then
_objProperty(NOO.enmCalcRangePpt.CharPosture) =
unoidl.com.sun.star.awt.FontSlant.ITALIC
_objProperty(NOO.enmCalcRangePpt.CharPostureAsian) = unoidl.com.sun.star.awt.FontSlant.ITALIC
value = NStr.nfReplace(value, "italic", "")
Else
_objProperty(NOO.enmCalcRangePpt.CharPosture) =
unoidl.com.sun.star.awt.FontSlant.NONE
_objProperty(NOO.enmCalcRangePpt.CharPostureAsian) =
unoidl.com.sun.star.awt.FontSlant.NONE
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
range FontStyle
''' </summary>
<Browsable(False)> _
Public
Property _fsFontStyle _
( _
) As FontStyle
Get
Dim fs As
New FontStyle
If
_objProperty(NOO.enmCalcRangePpt.CharPosture) = _
unoidl.com.sun.star.awt.FontSlant.ITALIC Then
fs = fs Or FontStyle.Italic
End If
If
_objProperty(NOO.enmCalcRangePpt.CharWeight) > 100 Then
fs = fs Or FontStyle.Bold
End If
If
_objProperty(NOO.enmCalcRangePpt.CharStrikeout) <> 0 Then
fs = fs Or FontStyle.Strikeout
End If
If
_objProperty(NOO.enmCalcRangePpt.CharUnderline) <> 0 Then
fs = fs Or FontStyle.Underline
End If
Return fs
End Get
Set(ByVal value As FontStyle)
Try
If value = FontStyle.Regular Then
_objProperty(NOO.enmCalcRangePpt.CharWeight) = 100
_objProperty(NOO.enmCalcRangePpt.CharWeightAsian) = 100
_objProperty(NOO.enmCalcRangePpt.CharStrikeout) = _
NSS.nfCInt(NOO.enmFontStrikeout.NONE)
_objProperty(NOO.enmCalcRangePpt.CharUnderline) = _
NSS.nfCInt(NOO.enmFontUnderline.NONE)
_objProperty(NOO.enmCalcRangePpt.CharPosture) = _
unoidl.com.sun.star.awt.FontSlant.NONE
_objProperty(NOO.enmCalcRangePpt.CharPostureAsian) = _
unoidl.com.sun.star.awt.FontSlant.NONE
Else
If (value And
FontStyle.Underline) <> 0 Then
_objProperty(NOO.enmCalcRangePpt.CharUnderline)
= _
NSS.nfCInt(NOO.enmFontUnderline.SINGLE)
End If
If (value And
FontStyle.Bold) <> 0 Then
'_objProperty(NOO.enmCalcRangePpt.CharWeight)
= _objProperty(NOO.enmCalcRangePpt.CharWeight) * 2
_objProperty(NOO.enmCalcRangePpt.CharWeight) = 200
'_objProperty(NOO.enmCalcRangePpt.CharWeightAsian)
= _objProperty(NOO.enmCalcRangePpt.CharWeightAsian) * 2
_objProperty(NOO.enmCalcRangePpt.CharWeightAsian)
= 200
End If
If (value And
FontStyle.Strikeout) <> 0 Then
_objProperty(NOO.enmCalcRangePpt.CharStrikeout) = _
NSS.nfCInt(NOO.enmFontStrikeout.SINGLE)
End If
If (value And
FontStyle.Italic) <> 0 Then
_objProperty(NOO.enmCalcRangePpt.CharPosture) =
unoidl.com.sun.star.awt.FontSlant.ITALIC
_objProperty(NOO.enmCalcRangePpt.CharPostureAsian) =
unoidl.com.sun.star.awt.FontSlant.ITALIC
End If
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
''' range
CharColor
''' </summary>
<Browsable(False)> _
Public
Property _clrCharColor _
( _
) As Color
Get
Return
Color.FromArgb(_objProperty(NOO.enmCalcRangePpt.CharColor))
End Get
Set(ByVal value As Color)
Try
If value.ToArgb <> 0 Then
_objProperty(NOO.enmCalcRangePpt.CharColor) = _
value.R * 65536 + value.G * 256 + value.B
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
CellBackColor
''' </summary>
<Browsable(False)> _
Public
Property _clrBackColor _
( _
) As Color
Get
Return Color.FromArgb(_objProperty(NOO.enmCalcRangePpt.CellBackColor))
End Get
Set(ByVal value As Color)
Try
If value.IsEmpty = False Then
_objProperty(NOO.enmCalcRangePpt.CellBackColor) = value.R * 65536 +
value.G * 256 + value.B
_objProperty(NOO.enmCalcRangePpt.IsCellBackgroundTransparent) = False
Else
_objProperty(NOO.enmCalcRangePpt.CellBackColor) = _
g_nsheet._clrSheetBackColor.ToArgb
_objProperty(NOO.enmCalcRangePpt.IsCellBackgroundTransparent) = True
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
HorizontalJustify
''' </summary>
<Browsable(False)> _
Public
Property _enmHoriJustify _
( _
) As NOO.enmCellHoriJustify
Get
Return
_objProperty(NOO.enmCalcRangePpt.HoriJustify)
End Get
Set(ByVal value As NOO.enmCellHoriJustify)
Try
_objProperty(NOO.enmCalcRangePpt.HoriJustify) = NSS.nfCInt(value)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
VerticalJustify
''' </summary>
<Browsable(False)> _
Public
Property _enmVertJustify _
( _
) As NOO.enmCellVertJustify
Get
Return
_objProperty(NOO.enmCalcRangePpt.VertJustify)
End Get
Set(ByVal value As NOO.enmCellVertJustify)
Try
_objProperty(NOO.enmCalcRangePpt.VertJustify) = NSS.nfCInt(value)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
BorderLines
''' </summary>
''' <param name="blnEachCell">true=set All Cell</param>
<Browsable(False)> _
Public
Property _clsBorderLines _
(Optional ByVal
blnEachCell As Boolean
= False _
) As NOO.g_ctypBorderLine()
Get
If blnEachCell = False Then
Dim tb As
unoidl.com.sun.star.table.TableBorder = _
_objProperty(NOO.enmCalcRangePpt.TableBorder)
Return NOO.nfGetTableBorderLines(tb,
g_rng)
Else
Dim rngCells() As
unoidl.com.sun.star.table.XCellRange = fGetAllCells()
Dim nrng As New nNCalcRange(g_nsheet, rngCells(0))
Return nrng._clsBorderLines(False)
End If
End Get
Set(ByVal values() As NOO.g_ctypBorderLine)
Try
If blnEachCell = False Then
'outside of Range BorderLine
_objProperty(NOO.enmCalcRangePpt.TableBorder) = _
NOO.nfSetTableBorderLines(g_rng, values)
Else
'all cell BorderLine
For p1 As
Integer = 0 To
values.Length - 1
Dim clsBL As
NOO.g_ctypBorderLine = values(p1)
Dim bl As
New unoidl.com.sun.star.table.BorderLine
bl.InnerLineWidth = clsBL.intInnerLineWidth
bl.OuterLineWidth = clsBL.intOuterLineWidth
bl.LineDistance = clsBL.intLineDistance
bl.Color = clsBL.clr.ToArgb
If clsBL.bli =
NOffice.enmBorderLineIndex.Around Then
_objProperty(NOO.enmCalcRangePpt.LeftBorder) = bl
_objProperty(NOO.enmCalcRangePpt.TopBorder) = bl
_objProperty(NOO.enmCalcRangePpt.RightBorder) = bl
_objProperty(NOO.enmCalcRangePpt.BottomBorder) = bl
ElseIf clsBL.bli = NOffice.enmBorderLineIndex.LeftRight
Then
_objProperty(NOO.enmCalcRangePpt.LeftBorder) = bl
_objProperty(NOO.enmCalcRangePpt.RightBorder) = bl
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.TopBottom Then
_objProperty(NOO.enmCalcRangePpt.TopBorder) = bl
_objProperty(NOO.enmCalcRangePpt.BottomBorder) = bl
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.EdgeLeft Then
_objProperty(NOO.enmCalcRangePpt.LeftBorder) = bl
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.EdgeTop Then
_objProperty(NOO.enmCalcRangePpt.TopBorder) = bl
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.EdgeRight Then
_objProperty(NOO.enmCalcRangePpt.RightBorder) = bl
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.EdgeBottom Then
_objProperty(NOO.enmCalcRangePpt.BottomBorder) = bl
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.DiagonalBoth Then
_objProperty(NOO.enmCalcRangePpt.DiagonalBLTR) = bl
_objProperty(NOO.enmCalcRangePpt.DiagonalTLBR) = bl
ElseIf clsBL.bli = NOffice.enmBorderLineIndex.DiagonalUp
Then
_objProperty(NOO.enmCalcRangePpt.DiagonalBLTR) = bl
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.DiagonalDown Then
_objProperty(NOO.enmCalcRangePpt.DiagonalTLBR) = bl
Else
NError.nfRaise(clsBL.bli, "clsBL.bli error")
End If
Next
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>get all
cells of Range
''' </summary>
Private
Function fGetAllCells _
( _
) As unoidl.com.sun.star.table.XCellRange()
Try
Dim rctRange As
Rectangle = fGetRangeRect(g_rng)
Dim lstCell As
New List(Of
unoidl.com.sun.star.table.XCellRange)
For py As
Integer = 0 To
rctRange.Height - 1
For px As
Integer = 0 To
rctRange.Width - 1
lstCell.Add(g_rng.getCellByPosition(py, px))
Next
Next
Return lstCell.ToArray
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
HorizontalPageBreak
''' </summary>
<Browsable(False)> _
Public
Property _blnHorizontalPageBreak _
( _
) As Boolean
Get
Dim xspb As
unoidl.com.sun.star.sheet.XSheetPageBreak = g_nsheet._sheet
Dim tpbds() As
unoidl.com.sun.star.sheet.TablePageBreakData = _
xspb.getRowPageBreaks
For p1 As
Integer = 0 To
tpbds.Length - 1
If tpbds(p1).ManualBreak = True AndAlso _
_rctRange.Y = tpbds(p1).Position + 1 Then
Return True
End If
Next
Return False
End Get
Set(ByVal Value As Boolean)
Try
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_nsheet._sheet
Dim xts As
unoidl.com.sun.star.table.XTableRows = xcrr.getRows
Dim ps As
unoidl.com.sun.star.beans.XPropertySet = _
xts.getByIndex(_rctRange.Y).Value
ps.setPropertyValue("IsStartOfNewPage" _
, New uno.Any(Value) _
)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
VerticalPageBreak
''' </summary>
<Browsable(False)> _
Public
Property _blnVerticalPageBreak _
( _
) As Boolean
Get
Dim xspb As
unoidl.com.sun.star.sheet.XSheetPageBreak = g_nsheet._sheet
Dim tpbds() As
unoidl.com.sun.star.sheet.TablePageBreakData = _
xspb.getColumnPageBreaks
For p1 As
Integer = 0 To
tpbds.Length - 1
If tpbds(p1).ManualBreak = True AndAlso _
_rctRange.X = tpbds(p1).Position + 1 Then
Return True
End If
Next
Return False
End Get
Set(ByVal Value As Boolean)
Try
Dim xcrr As
unoidl.com.sun.star.table.XColumnRowRange = g_nsheet._sheet
Dim xts As
unoidl.com.sun.star.table.XTableColumns = xcrr.getColumns
Dim ps As
unoidl.com.sun.star.beans.XPropertySet = _
xts.getByIndex(_rctRange.X).Value
ps.setPropertyValue("IsStartOfNewPage"
_
, New uno.Any(Value) _
)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
Locked
''' </summary>
<Browsable(False)> _
Public
Property _blnLocked _
( _
) As Boolean
Get
Dim cp As
unoidl.com.sun.star.util.CellProtection = _
NOO._objProperty(g_rng, "CellProtection")
Return cp.IsLocked
End Get
Set(ByVal Value As Boolean)
Try
'NOO.nfPropertyDisplay(g_rng)
Dim cp As
unoidl.com.sun.star.util.CellProtection = _
NOO._objProperty(g_rng, "CellProtection")
cp.IsLocked = Value
NOO._objProperty(g_rng, "CellProtection") = cp
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
formula
''' </summary>
<Browsable(False)> _
Public
Property _strFomula _
( _
) As String
Get
Dim xcell As
unoidl.com.sun.star.table.XCell = _
g_rng.getCellByPosition(0, 0)
Return xcell.getFormula
End Get
Set(ByVal Value As String)
Try
'NOO.nfPropertyDisplay(g_rng)
Dim xcell As
unoidl.com.sun.star.table.XCell = _
g_rng.getCellByPosition(0, 0)
xcell.setFormula(Value)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>RangeX
''' </summary>
''' <param name="blnInch">true=inch false=mm</param>
<Browsable(False)> _
Public
ReadOnly Property
_dblRangeX _
(Optional
ByVal blnInch As
Boolean = False
_
) As Double
Get
Dim pnt As
Point = NOO.nfToDrawingPoint(_objProperty(NOO.enmCalcRangePpt.Position))
If blnInch = True
Then
Return pnt.X / 100 / 25.4
Else
Return pnt.X / 100
End If
End Get
End
Property
''' <summary>RangeY
''' </summary>
''' <param name="blnInch">true=inch false=mm</param>
<Browsable(False)> _
Public
ReadOnly Property
_dblRangeY _
(Optional ByVal
blnInch As Boolean
= False _
) As Double
Get
Dim pnt As
Point = _
NOO.nfToDrawingPoint(_objProperty(NOO.enmCalcRangePpt.Position))
If blnInch = True
Then
Return pnt.Y / 100 / 25.4
Else
Return pnt.Y / 100
End If
End Get
End
Property
''' <summary>RangeWidth
''' </summary>
''' <param name="blnInch">true=inch false=mm</param>
<Browsable(False)> _
Public
ReadOnly Property
_dblRangeWidth _
(Optional ByVal
blnInch As Boolean
= False _
) As Double
Get
Dim siz As
Size = NOO.nfToDrawingSize(_objProperty(NOO.enmCalcRangePpt.Size))
If blnInch = True
Then
Return siz.Width / 100 / 25.4
Else
Return siz.Width / 100
End If
End Get
'cant set
'Set(ByVal value As Double)
' Try
' If blnInch =
True Then
'
value *= 25.4
' End If
' Dim siz As Size
= NOO.nfToDrawingSize(_objProperty(NOO.enmCalcRangePpt.Size))
' siz.Width =
value * 100
'
_objProperty(NOO.enmCalcRangePpt.Size) = NOO.nfToawtSize(siz)
' Catch
ex As Exception
'
NError.nfShow(ex, Err.Number)
' End Try
'End Set
End Property
''' <summary>RangeHeight
''' </summary>
''' <param name="blnInch">true=inch false=mm</param>
<Browsable(False)> _
Public
ReadOnly Property
_dblRangeHeight _
(Optional ByVal
blnInch As Boolean
= False _
) As Double
Get
Dim siz As
Size = NOO.nfToDrawingSize(_objProperty(NOO.enmCalcRangePpt.Size))
If blnInch = True
Then
Return siz.Height / 100 / 25.4
Else
Return siz.Height / 100
End If
End Get
End Property
''' <summary>
'''
XCellRange
''' </summary>
''' <param name="intIndex">Index of array(1-)</param>
<Browsable(False)> _
Public
ReadOnly Property
_Range _
(Optional ByVal
intIndex As Integer
= 0 _
) As unoidl.com.sun.star.table.XCellRange
Get
If intIndex <> 0 Then
Dim int1 As
Integer = _intNumArrays
If _intNumArrays < 2 OrElse _
intIndex > _intNumArrays Then
NError.nfRaise(intIndex, "intIndex error")
End If
Return g_lstArrayRange(intIndex - 1)
Else
Return g_rng
End If
End Get
End
Property
Structure
g_typImage
Dim ipnt As Point
Dim strFile As String
Dim strName As String
End
Structure
''' <summary>
'''
DataArray
''' </summary>
<Browsable(False)> _
Public
Property _objDataArray _
( _
) As Object()()
Get
Dim rd As
unoidl.com.sun.star.sheet.XCellRangeData = g_rng
Dim uno()() As
uno.Any = rd.getDataArray()
Dim objss(uno.Length - 1)() As Object
For p1 As
Integer = 0 To
uno.Length - 1
ReDim objss(p1)(uno(p1).Length - 1)
For p2 As
Integer = 0 To
uno(p1).Length - 1
objss(p1)(p2)
= uno(p1)(p2).Value
Next
Next
Return objss
End Get
Set(ByVal Valuess As Object()())
Try
Dim unoss(Valuess.Length - 1)() As uno.Any
For py As
Integer = 0 To
Valuess.Length - 1
ReDim unoss(py)(Valuess(py).Length - 1)
For px As
Integer = 0 To
unoss(py).Length - 1
unoss(py)(px) = New
uno.Any(Valuess(py)(px).GetType, Valuess(py)(px))
Next
Next
Dim rd As
unoidl.com.sun.star.sheet.XCellRangeData = g_rng
rd.setDataArray(unoss)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
''' Property
''' </summary>
<Browsable(False)> _
Public
Property _objProperty _
(ByVal enm As
NOO.enmCalcRangePpt _
) As Object
Get
Dim strPropertyName As String = _
[Enum].GetName(GetType(NOO.enmCalcRangePpt),
enm)
Dim ps As
unoidl.com.sun.star.beans.XPropertySet = g_rng
If
ps.getPropertySetInfo.hasPropertyByName(strPropertyName) = True Then
Return
ps.getPropertyValue(strPropertyName).Value
End If
NError.nfRaise(strPropertyName, "strPropertyName error")
Return Nothing
End Get
Set(ByVal value As Object)
Try
Dim strPropertyName As String =
[Enum].GetName(GetType(NOO.enmCalcRangePpt),
enm)
Dim ps As
unoidl.com.sun.star.beans.XPropertySet = g_rng
If
ps.getPropertySetInfo.hasPropertyByName(strPropertyName) = True Then
ps.setPropertyValue(strPropertyName _
, New uno.Any(value.GetType, value) _
)
Else
NError.nfRaise(strPropertyName, "strPropertyName error")
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
End Class
4-1.nNWriter
Imports System.ComponentModel
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
''' <summary>
''' Open Office Calc
''' </summary>
Public Class nNWriter
Private
g_strVersion As String
= ""
Public
g_xcc As
unoidl.com.sun.star.uno.XComponentContext
'Public
g_xmcf As unoidl.com.sun.star.lang.XMultiComponentFactory
Private
g_xcl As
unoidl.com.sun.star.frame.XComponentLoader
Public
g_xdh As
unoidl.com.sun.star.frame.XDispatchHelper
'Public
g_scriptprovider As XScriptProvider
Public
Sub New _
( _
)
Try
g_xcc = uno.util.Bootstrap.bootstrap
Dim xmsf As
unoidl.com.sun.star.lang.XMultiServiceFactory = _
g_xcc.getServiceManager
g_xcl = xmsf.createInstance("com.sun.star.frame.Desktop")
g_xdh =
xmsf.createInstance("com.sun.star.frame.DispatchHelper")
'Dim strs() As String =
g_xmcf.getAvailableServiceNames()
'Array.Sort(strs)
'NMsgBox.nfShow(strs)
'Dim strs() As String =
g_XServiceManager.getAvailableServiceNames()
'Array.Sort(strs)
'NMsgBox.nfShow(strs)
'Dim strs() As String =
context.getServiceManager
'Array.Sort(strs)
'NMsgBox.nfShow(strs)
'get Version
Dim XConfigurationProvider As unoidl.com.sun.star.lang.XMultiServiceFactory = _
xmsf.createInstance("com.sun.star.configuration.ConfigurationProvider")
Dim params(0) As
uno.Any
params(0) = New uno.Any(GetType(unoidl.com.sun.star.beans.PropertyValue) _
, New
unoidl.com.sun.star.beans.PropertyValue("nodepath" _
, 0 _
, New
uno.Any("/org.openoffice.Setup/Product") _
, unoidl.com.sun.star.beans.PropertyState.DEFAULT_VALUE _
) _
)
Dim xna As
unoidl.com.sun.star.container.XNameAccess = _
XConfigurationProvider.createInstanceWithArguments _
("com.sun.star.configuration.ConfigurationAccess", params)
g_strVersion = xna.getByName("ooSetupVersion").Value.ToString
Catch ex As Exception
NError.nfShow(ex, Err.Number)
End Try
End
Sub
''' <summary>
'''
CreateDoc
''' </summary>
''' <param name="strDocFile">DocFile
ex)odt,pdf</param>
''' <param name="strTemplateDocFile">TemplateDocFile</param>
''' <param name="blnHidden">true=hidden</param>
Public
Function nfDocCreate _
(ByVal strDocFile As String _
, Optional ByVal
strTemplateDocFile As String
= "" _
, Optional ByVal
blnHidden As Boolean
= True _
) As nNWriterDoc
Try
If strDocFile.EndsWith(".odt",
NConst.scOrdinalIC) = False AndAlso _
strDocFile.EndsWith(".pdf", NConst.scOrdinalIC) = False Then
NError.nfRaise(strDocFile, "strDocFile extention error")
End If
If strTemplateDocFile <>
"" Then
If NIO.nfFileExists(strDocFile) =
"" Then
If NIO.nfIsReadOnly(strDocFile) Then
NIO.nfRemovePathAttributes(strDocFile, IO.FileAttributes.ReadOnly)
End If
End If
NIO.nfCopy(strTemplateDocFile, strDocFile)
Return nfDocOpen(strDocFile, ,
blnHidden)
End If
Dim npv As
New nNOOPropertyValue
Dim lstArg As
New List(Of
unoidl.com.sun.star.beans.PropertyValue)
If blnHidden = True
Then
npv.nfAdd("Hidden", True)
End If
Dim doc As
unoidl.com.sun.star.text.XTextDocument = _
g_xcl.loadComponentFromURL("private:factory/swriter" _
,
"_blank" _
, 0 _
, npv._PropertyValues _
)
Dim ndoc As
New nNWriterDoc(Me,
doc, strDocFile, True)
'NOO.nfPropertyDisplay(ndoc._doc)
''service of Doc
'Dim xmsf As XMultiServiceFactory = doc
'Dim strs() As String =
xmsf.getAvailableServiceNames
'NMsgBox.nfShow(strs)
''NOO.nfPropertyDisplay(xtcMsterUser)
Return ndoc
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
CreateDoc
''' </summary>
''' <param name="strDocFile">DocFile</param>
''' <param name="strPassword">Password</param>
''' <param name="blnHidden">true=hidden</param>
Public
Function nfDocOpen _
(ByVal strDocFile As String _
, Optional ByVal
strPassword As String
= "" _
, Optional ByVal
blnHidden As Boolean
= True _
) As nNWriterDoc
Try
If NIO.nfFileExists(strDocFile) <>
"" Then
NError.nfRaise(strDocFile, "strDocFile error")
End If
If strDocFile.EndsWith(".odt",
NConst.scOrdinalIC) = False Then
NError.nfRaise(strDocFile, "strDocFile extention error")
End If
Dim npv As
New nNOOPropertyValue
Dim lstArg As
New List(Of
unoidl.com.sun.star.beans.PropertyValue)
If blnHidden = True
Then
npv.nfAdd("Hidden", True)
End If
If strPassword <> "" Then
npv.nfAdd("Password", strPassword)
End If
Dim strURL As
String = NIO.nfFilePathToFileURL(strDocFile)
Dim doc As
unoidl.com.sun.star.text.XTextDocument = _
g_xcl.loadComponentFromURL(NIO.nfFilePathToFileURL(strDocFile) _
, "_blank" _
, 0 _
, npv._PropertyValues _
)
If doc Is
Nothing Then
NError.nfRaise(strDocFile, "OpenDoc error")
End If
Dim ndoc As
New nNWriterDoc(Me,
doc, strDocFile, False)
Return ndoc
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Close
''' </summary>
''' <param name="ndoc">nNOOWriterDoc</param>
Public
Function nfDocClose _
(ByVal ndoc As
nNWriterDoc _
) As Boolean
Try
Dim xcla As
unoidl.com.sun.star.util.XCloseable = ndoc._doc
xcla.close(False)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Version
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_strVersion() As String
Get
Return g_strVersion
End Get
End
Property
End Class
4-2.nNWriterDoc
Imports System.Windows.Forms
Imports System.ComponentModel
Imports System.Drawing
Imports System.Text
Public Class nNWriterDoc
Public
g_nwriter As nNWriter = Nothing
Private
g_doc As unoidl.com.sun.star.text.XTextDocument
Private
g_strDocFile As String
Private
g_strCurrentDocFile As String
Public
g_blnCreate As Boolean
Private
g_strPassword As String
Public
Sub New _
(ByVal nwriter As
nNWriter _
, ByVal doc As
unoidl.com.sun.star.text.XTextDocument _
, ByVal strDocFile As String _
, ByVal blnCreate As Boolean _
)
Try
g_nwriter = nwriter
g_doc = doc
g_strDocFile = strDocFile
g_strCurrentDocFile = strDocFile
g_blnCreate = blnCreate
'Dim xpb As XPrintable = g_doc
'Dim pvs() As PropertyValue = xpb.getPrinter
'Dim str1 As String = ""
'For p1 As Integer = 0 To pvs.Length - 1
'
str1 &= pvs(p1).Name & vbTab &
pvs(p1).Value.Value.GetType.ToString
'
If pvs(p1).Name = "PaperFormat" Then
' Dim pf As
PaperFormat = pvs(p1).Value.Value
' str1 &=
vbTab & pf.ToString & vbTab & pf
'
End If
'
str1 &= vbLf
'Next
'NMsgBox.nfShow(str1)
'Dim xbms As XBookmarksSupplier = g_doc
'Dim strs() As String = xbms.getBookmarks.getElementNames()
'Dim xtc As XTextContent =
xbms.getBookmarks.getByName("tm1").Value
'Dim xtr As XTextRange = xtc.getAnchor
'Dim xtxt As XText = g_doc.getText
'Dim xtcur As XTextCursor = xtxt.createTextCursorByRange(xtr)
'xtcur.setString("aaaaaa")
'NOO.nfPropertyDisplay(g_doc)
'Dim xfs As XStyleFamiliesSupplier = g_doc
'Dim xnc As XNameContainer =
xfs.getStyleFamilies.getByName("PageStyles").Value
'Dim strs() As String = xnc.getElementNames
'Dim ps As XPropertySet =
xnc.getByName("Standard").Value
'NOO.nfPropertyDisplay(ps)
'nfGetSheet(1)._FreezePane = New Point(2, 3)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
End Try
End
Sub
''' <summary>get
Paragraph
'''
[return]g_ctypParagraph()
''' </summary>
''' <param name="strBookmarkName">BookmarkName(Point or Area)</param>
Public
Function nfGetParagraph _
(ByVal strBookmarkName As
String _
) As g_ctypParagraph()
Try
Dim xrng As
unoidl.com.sun.star.text.XTextRange = _
fGetBookmarkRange(strBookmarkName)
Dim xtcur As
unoidl.com.sun.star.text.XTextCursor = _
g_doc.getText.createTextCursorByRange(xrng)
Return fGetParagraphs(xtcur)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
Private
Function fGetParagraphs _
(ByVal xtcur As
unoidl.com.sun.star.text.XTextCursor _
) As g_ctypParagraph()
Try
Dim lst As
New List(Of
g_ctypParagraph)
Dim blnBreak As
Boolean = True
Dim intSelLength As Integer = _
xtcur.getString.Replace(ChrW(13) & ChrW(10), ChrW(13)).Length
xtcur.collapseToStart()
For int1 As
Integer = 1 To
intSelLength
If xtcur.goRight(1, True) = False Then
Exit For
End If
If blnBreak = True
Then
lst.Add(fGetParagraphData(xtcur))
blnBreak = False
End If
Dim strText As
String = xtcur.getString
'NMsgBox.nfDebugShow(strText)
With lst(lst.Count - 1)
If strText = ChrW(13) & ChrW(10) Then
.blnCRLF
= True
xtcur.collapseToEnd()
blnBreak = True
Continue For
End If
Dim pg As
g_ctypParagraph = fGetParagraphData(xtcur)
If fParagraphCompare(pg, lst(lst.Count -
1)) = False Then
lst.Add(pg)
End If
lst(lst.Count - 1).strText &= strText
'NMsgBox.nfDebugShow(lst(lst.Count -
1).strText)
End With
xtcur.collapseToEnd()
Next
Return lst.ToArray
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
Private
Function fGetParagraphData _
(ByVal xtcur As
unoidl.com.sun.star.text.XTextCursor _
) As g_ctypParagraph
Try
Dim clsParagraph As New g_ctypParagraph
Dim xrng As
unoidl.com.sun.star.text.XTextRange = xtcur
Dim fnt As
Font = NOO._Font(xtcur)
If fnt Is
Nothing OrElse
_
fnt.Equals(_fntDoc)
= False Then
clsParagraph.fnt = fnt
End If
Dim intColor As
Integer = NOO._objProperty(xtcur,
"CharColor")
If intColor > 0 Then
clsParagraph.clrFont = Color.FromArgb(intColor)
End If
Return clsParagraph
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
Private
Function fParagraphCompare _
(ByVal pg1 As
g_ctypParagraph _
, ByVal pg2 As
g_ctypParagraph _
) As Boolean
Try
If pg1.fnt Is
Nothing AndAlso
_
pg2.fnt IsNot Nothing
Then
Return False
End If
If pg1.fnt IsNot
Nothing AndAlso
_
pg2.fnt Is Nothing
Then
Return False
End If
If pg1.fnt IsNot
Nothing AndAlso
_
pg1.fnt.Equals(pg2.fnt) = False Then
Return False
End If
If pg1.clrFont = Nothing AndAlso _
pg2.clrFont <> Nothing Then
Return False
End If
If pg1.clrFont <> Nothing AndAlso _
pg2.clrFont = Nothing Then
Return False
End If
If pg1.clrFont <> Nothing AndAlso _
pg1.clrFont.Equals(pg2.clrFont) = False Then
Return False
End If
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
Public
Class g_ctypParagraph
Public strText As String = ""
Public blnCRLF As Boolean = False
Public fnt As Font = Nothing
Public clrFont As
Color = Nothing
Public Sub New _
(Optional ByVal
Text As String
= "" _
, Optional ByVal CRLF As Boolean = False _
, Optional
ByVal fnt1 As
Font = Nothing _
, Optional ByVal
objFontColor As Object
= Nothing _
)
strText = Text
blnCRLF = CRLF
fnt = fnt1
clrFont = objFontColor
End Sub
End
Class
''' <summary>set
Paragraph
'''
[return]String error content
''' </summary>
''' <param name="strText">Text</param>
''' <param name="strBookmarkName">BookmarkName(Point or Area) end=\endofdoc</param>
''' <param name="blnCRLF">true=CRLF</param>
''' <param name="fnt">Font</param>
''' <param name="objFontColor">FontColor</param>
''' <param name="chrInsertPlace">b=before,a=after,r=replace</param>
Public
Function nfSetParagraph _
(ByVal strText As String _
, Optional ByVal
strBookmarkName As String
= "\endofdoc" _
, Optional ByVal
blnCRLF As Boolean
= False _
, Optional ByVal fnt As Font = Nothing _
, Optional ByVal
objFontColor As Object
= Nothing _
, Optional ByVal
chrInsertPlace As Char
= "b"c _
) As String
Try
Dim clsParagraphs(0) As g_ctypParagraph
clsParagraphs(0) = New
g_ctypParagraph(strText _
, blnCRLF _
, fnt _
,
objFontColor _
)
Return nfSetParagraphs(clsParagraphs _
, strBookmarkName _
, chrInsertPlace _
)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>set
Paragraphs
'''
[return]String error content
''' </summary>
''' <param name="clsParagraphs">array of g_ctypParagraph</param>
''' <param name="strBookmarkName">BookmarkName(Point or Area) end=\endofdoc</param>
''' <param name="chrInsertPlace">b=before,a=after,r=replace</param>
Public
Function nfSetParagraphs _
(ByVal clsParagraphs() As
g_ctypParagraph _
, Optional ByVal
strBookmarkName As String
= "\endofdoc" _
, Optional ByVal
chrInsertPlace As Char
= "b"c _
) As String
Try
Dim xrng As
unoidl.com.sun.star.text.XTextRange = Nothing
If NStr.nfCompare(strBookmarkName,
"\endofdoc") = 0 Then
Dim xtxt As
unoidl.com.sun.star.text.XText = g_doc.getText()
xrng = xtxt.getEnd
Else
xrng = fGetBookmarkRange(strBookmarkName)
End If
Return fSetParagraphs(clsParagraphs _
, g_doc.getText.createTextCursorByRange(xrng) _
, chrInsertPlace _
, strBookmarkName _
)
Catch ex As Exception
NError.nfShow(ex,
Err.Number)
Return Nothing
End Try
End
Function
Private
Function fSetParagraphs _
(ByVal clsParagraphs() As
g_ctypParagraph _
, ByVal xtcur As
unoidl.com.sun.star.text.XTextCursor _
, ByVal chrInsertPlace As
Char _
, ByVal strBookmarkName As
String _
) As String
Try
Dim intOriginalLength As Integer = _
xtcur.getString.Replace(ChrW(13) & ChrW(10), ChrW(13)).Length
If chrInsertPlace = "b" Then
xtcur.collapseToStart()
ElseIf chrInsertPlace = "a" Then
xtcur.collapseToEnd()
End If
Dim intInsertLength As Integer = 0
For p1 As
Integer = 0 To
clsParagraphs.Length - 1
If clsParagraphs(p1) Is Nothing Then
Continue For
End If
With clsParagraphs(p1)
xtcur.setString(.strText)
intInsertLength += .strText.Length
If .fnt IsNot
Nothing Then
NOO._Font(xtcur) = .fnt
'Else
'
NOO._Font(xtcur) = _fntDoc
End If
If .clrFont = Nothing
Then
NOO._objProperty(xtcur, "CharColor") = -1
Else
NOO._objProperty(xtcur,
"CharColor") = _
RGB(.clrFont.B, .clrFont.G, .clrFont.R)
End If
xtcur.collapseToEnd()
If .blnCRLF = True
Then
xtcur.setString(ChrW(13))
intInsertLength
+= 1
xtcur.collapseToEnd()
End If
End With
Next
If strBookmarkName <> ""
Then
're-set bookmark
If chrInsertPlace = "b" Then
xtcur.goLeft(intInsertLength, False)
xtcur.goRight(intInsertLength + intOriginalLength, True)
ElseIf chrInsertPlace = "a" Then
xtcur.goLeft(intOriginalLength + intInsertLength, False)
xtcur.goRight(intInsertLength + intOriginalLength, True)
Else
xtcur.goLeft(intInsertLength, False)
xtcur.goRight(intInsertLength, True)
End If
'set new bookmark
Dim xmsf As
unoidl.com.sun.star.lang.XMultiServiceFactory = g_doc
Dim xbmk As
unoidl.com.sun.star.text.XTextContent = _
xmsf.createInstance("com.sun.star.text.Bookmark")
Dim xnmd As
unoidl.com.sun.star.container.XNamed = xbmk
xnmd.setName(strBookmarkName)
Dim xtxt As
unoidl.com.sun.star.text.XText = g_doc.getText()
xtxt.insertTextContent(xtcur, xbmk, True)
End If
Return ""
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>AddPageBreak
'''
[return]String error content
''' </summary>
Public
Function nfAddPageBreak _
( _
) As String
Try
Dim xtxt As
unoidl.com.sun.star.text.XText = g_doc.getText()
Dim xrng As
unoidl.com.sun.star.text.XTextRange = xtxt.getEnd
Dim xtcur As
unoidl.com.sun.star.text.XTextCursor = _
g_doc.getText.createTextCursorByRange(xrng)
'NOO.nfPropertyDisplay(xtcur)
NOO._objProperty(xtcur, "BreakType") = _
unoidl.com.sun.star.style.BreakType.PAGE_AFTER
xtcur.setString(ChrW(13))
Return ""
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
Public
Class g_ctypLine
'No LineStyle in OOO3.2.1
'Public enmStyle As enmWdLineStyle =
enmWdLineStyle.wdLineStyleSingle
Public int100mmWidth As
Integer
Public clr As Color =
Color.Empty
Public Sub New _
(ByVal x100mmWidth As Integer _
, ByVal clr2 As Color _
)
int100mmWidth = x100mmWidth
clr = clr2
End Sub
End
Class
Public
Class g_ctypCell
''' <summary>0` -1=AllRow</summary>
Public pRow As Integer
''' <summary>0`
-1=AllColumn</summary>
Public pColumn As Integer
Public fnt As Font = Nothing
Public clsOutsideLine As
g_ctypLine = Nothing
Public clrBack As
Color = Color.Empty
Public clrFore As
Color = Color.Empty
Public enmHorizontalAlignment As NOffice.enmHorizontalAlignment = _
NOffice.enmHorizontalAlignment.LEFT
Public enmVerticalAlignment As
NOffice.enmVerticalAlignment = _
NOffice.enmVerticalAlignment.TOP
Public Sub New _
(Optional ByVal
Row As Integer
= 1 _
, Optional ByVal Column
As Integer = 1
_
, Optional ByVal fnt2 As Font = Nothing _
, Optional ByVal
OutsideLine As g_ctypLine = Nothing _
, Optional ByVal
BackColor As Object
= Nothing _
, Optional ByVal
ForeColor As Object
= Nothing _
, Optional ByVal
HorizontalAlignment As
NOffice.enmHorizontalAlignment = _
NOffice.enmHorizontalAlignment.LEFT _
, Optional
ByVal VerticalAlignment As NOffice.enmVerticalAlignment = _
NOffice.enmVerticalAlignment.TOP _
)
pRow = Row
pColumn = Column
fnt = fnt2
clsOutsideLine = OutsideLine
clrBack = BackColor
clrFore = ForeColor
enmHorizontalAlignment = HorizontalAlignment
enmVerticalAlignment = VerticalAlignment
End Sub
End
Class
''' <summary>set Table
'''
[return]String =error content
''' </summary>
''' <param
name="intNumColumns">number of
columns</param>
''' <param name="intNumRows">number of rows</param>
''' <param name="intColumnCharacters">array of column numcharacters
''' if less than intNumColumn the last one
apply
''' nothing is default height
''' </param>
''' <param name="intRowHeights">array of row height(1/100mm)
''' if less than intNumRows the last one
apply
''' nothing is default height
''' </param>
''' <param name="fnt">Table Font Nothing=default</param>
''' <param name="objFontColor">FontColor Nothing=default</param>
''' <param name="clsCellProperties">CellProperties Nothing=None</param>
''' <param name="clsOutsideLine">OutsizeLine attribute Nothing=default</param>
''' <param name="clsInsideLine">InsizeLine attribute Nothing=default</param>
Public
Function nfSetTable _
(ByVal intNumColumns As
Integer _
, ByVal intNumRows As Integer _
, ByVal intColumnCharacters() As
Integer _
, Optional ByVal
strBookmarkName As String
= "\endofdoc" _
, Optional ByVal
intRowHeights() As Integer
= Nothing _
, Optional ByVal fnt As Font = Nothing _
, Optional ByVal
objFontColor As Object
= Nothing _
, Optional ByVal
clsCellProperties() As g_ctypCell = Nothing _
, Optional ByVal
clsOutsideLine As g_ctypLine = Nothing _
, Optional ByVal
clsInsideLine As g_ctypLine = Nothing _
) As String
Try
Dim xmsf As
unoidl.com.sun.star.lang.XMultiServiceFactory = g_doc
Dim xtbl As
unoidl.com.sun.star.text.XTextTable = _
xmsf.createInstance("com.sun.star.text.TextTable")
xtbl.initialize(intNumRows, intNumColumns)
Dim xtxt As
unoidl.com.sun.star.text.XText = Nothing
Dim xrng As
unoidl.com.sun.star.text.XTextRange = Nothing
If NStr.nfCompare(strBookmarkName,
"\endofdoc") = 0 Then
xtxt = g_doc.getText()
xrng = xtxt.getEnd
Else
xrng = fGetBookmarkRange(strBookmarkName)
End If
xtxt.insertTextContent(xrng, xtbl, False)
If fnt Is
Nothing Then
fnt = NOO._Font(xrng)
End If
'NOO.nfPropertyDisplay(xrng)
'''''''''''''next should process after
insertTextContent
Dim xcellrng As
unoidl.com.sun.star.table.XCellRange = xtbl
'NOO.nfPropertyDisplay(xcellrng)
'''''''(Achtung) by default no1 row is set to
header row style
'''''''so change to ordinal row style
For pRow As
Integer = 0 To
intNumRows - 1
For pColumn As
Integer = 0 To
intNumColumns - 1
Dim xcell As
unoidl.com.sun.star.table.XCell = _
xcellrng.getCellByPosition(pColumn, pRow)
Dim xtxt1 As
unoidl.com.sun.star.text.XText = xcell
Dim xrng1 As
unoidl.com.sun.star.text.XTextRange = xtxt1.getEnd
NOO._Font(xrng1) = fnt
Dim fc As
Color = objFontColor
NOO._objProperty(xrng1, "CharColor") = RGB(fc.B, fc.G, fc.R)
NOO._objProperty(xrng1, "ParaAdjust") = _
unoidl.com.sun.star.style.ParagraphAdjust.LEFT
Next
Next
If intColumnCharacters IsNot Nothing Then
Dim int100mmWidths(intNumColumns - 1) As Integer
Dim int100mmTotalWidth As Integer = 0
For p1 As
Integer = 0 To
intNumColumns - 1
Dim p2 As
Integer = 0
If p1 <= intColumnCharacters.Length -
1 Then
p2 = p1
Else
p2 = intColumnCharacters.Length - 1
End If
int100mmWidths(p1) = _
NOffice.nfNumCharactersTo100mm(intColumnCharacters(p2) _
, fnt _
) + 200
int100mmTotalWidth += int100mmWidths(p1)
Next
Dim tcs() As
unoidl.com.sun.star.text.TableColumnSeparator = _
NOO._objProperty(xtbl, "TableColumnSeparators")
Dim intPos As
Integer = 0
For p1 As
Integer = 0 To
int100mmWidths.Length - 2
'nnnn/10000 %set
intPos += int100mmWidths(p1) * 10000 / int100mmTotalWidth
tcs(p1).Position = intPos
Next
NOO._objProperty(xtbl, "TableColumnSeparators") = tcs
'should set after position set
NOO._objProperty(xtbl, "HoriOrient") = _
unoidl.com.sun.star.text.HoriOrientation.LEFT
NOO._objProperty(xtbl, "Width") = int100mmTotalWidth '1/100mm
set
Else
NOO._objProperty(xtbl, "HoriOrient") = _
unoidl.com.sun.star.text.HoriOrientation.NONE
End If
'unuseful for bug
'Dim xtblColumns As
unoidl.com.sun.star.table.XTableColumns = xtbl.getColumns
'For p1 As Integer = 0 To xtblColumns.getCount
- 1
'
'bug objColumn=null
'
Dim objColumn As Object = xtblColumns.getByIndex(p1).Value
'
NOO.nfPropertyDisplay(objColumn)
'Next
If
intRowHeights IsNot Nothing
Then
Dim xtblRows As
unoidl.com.sun.star.table.XTableRows = xtbl.getRows()
For p1 As
Integer = 0 To
xtblRows.getCount - 1
Dim objRow As
Object = xtblRows.getByIndex(p1).Value
'NOO.nfPropertyDisplay(objRow)
NOO._objProperty(objRow, "IsAutoHeight") = False
Dim p2 As
Integer = 0
If p1 <= intRowHeights.Length - 1 Then
p2 = p1
Else
p2 = intRowHeights.Length - 1
End If
NOO._objProperty(objRow, "Height") = intRowHeights(p2)
Next
End If
If clsCellProperties IsNot Nothing Then
For p1 As
Integer = 0 To
clsCellProperties.Length - 1
With clsCellProperties(p1)
For pColumn As
Integer = 0 To
intNumColumns - 1
If .pColumn = -1 OrElse _
.pColumn = pColumn Then
For pRow As
Integer = 0 To
intNumRows - 1
If .pRow = -1 OrElse
_
.pRow = pRow Then
Dim xcell As
unoidl.com.sun.star.table.XCell = _
xcellrng.getCellByPosition(pColumn, pRow)
Dim xtxt1 As
unoidl.com.sun.star.text.XText = xcell
Dim xrng1 As
unoidl.com.sun.star.text.XTextRange = _
xtxt1.getEnd
If .fnt IsNot Nothing Then
NOO._Font(xrng1) = fnt
End If
'NOO.nfPropertyDisplay(xcell)
If .clsOutsideLine IsNot Nothing Then
Dim bl As
unoidl.com.sun.star.table.BorderLine = _
NOO._objProperty(xcell, "LeftBorder")
bl.Color = .clsOutsideLine.clr.ToArgb
bl.OuterLineWidth
= .clsOutsideLine.int100mmWidth
NOO._objProperty(xcell, "LeftBorder") = bl
bl = NOO._objProperty(xcell, "TopBorder")
bl.Color = .clsOutsideLine.clr.ToArgb
bl.OuterLineWidth = .clsOutsideLine.int100mmWidth
NOO._objProperty(xcell, "TopBorder") = bl
bl = NOO._objProperty(xcell, "RightBorder")
bl.Color = .clsOutsideLine.clr.ToArgb
bl.OuterLineWidth = .clsOutsideLine.int100mmWidth
NOO._objProperty(xcell, "RightBorder") = bl
bl
= NOO._objProperty(xcell, "BottomBorder")
bl.Color = .clsOutsideLine.clr.ToArgb
bl.OuterLineWidth = .clsOutsideLine.int100mmWidth
NOO._objProperty(xcell, "BottomBorder") = bl
End If
If .clrBack.IsEmpty = False Then
'CTPAHHO R,G,B
NOO._objProperty(xcell, "BackColor") = _
RGB(.clrBack.B, .clrBack.G, .clrBack.R)
End If
If .clrFore.IsEmpty = False Then
'CTPAHHO R,G,B
NOO._objProperty(xrng1,
"CharColor") = _
RGB(.clrFore.B, .clrFore.G, .clrFore.R)
End If
If .enmHorizontalAlignment =
NOffice.enmHorizontalAlignment.LEFT Then
NOO._objProperty(xrng1, "ParaAdjust") = _
unoidl.com.sun.star.style.ParagraphAdjust.LEFT
ElseIf .enmHorizontalAlignment =
NOffice.enmHorizontalAlignment.CENTER Then
NOO._objProperty(xrng1, "ParaAdjust") = _
unoidl.com.sun.star.style.ParagraphAdjust.CENTER
ElseIf .enmHorizontalAlignment =
NOffice.enmHorizontalAlignment.RIGHT Then
NOO._objProperty(xrng1, "ParaAdjust") = _
unoidl.com.sun.star.style.ParagraphAdjust.RIGHT
End If
If .enmVerticalAlignment =
NOffice.enmVerticalAlignment.TOP Then
NOO._objProperty(xcell, "VertOrient") = _
unoidl.com.sun.star.text.VertOrientation.TOP
ElseIf .enmVerticalAlignment =
NOffice.enmVerticalAlignment.CENTER Then
NOO._objProperty(xcell, "VertOrient") = _
unoidl.com.sun.star.text.VertOrientation.CENTER
ElseIf .enmVerticalAlignment =
NOffice.enmVerticalAlignment.BOTTOM Then
NOO._objProperty(xcell, "VertOrient") = _
unoidl.com.sun.star.text.VertOrientation.BOTTOM
End
If
End If
Next
End If
Next
End With
Next
End If
'NMsgBox.nfShow(NOO.nfGetTableBorderLines(NOO._objProperty(xtbl,
"TableBorder"), Nothing))
Dim clsBorderLines() As NOO.g_ctypBorderLine = _
NOO.nfGetTableBorderLines(NOO._objProperty(xtbl,
"TableBorder"), Nothing)
If clsOutsideLine IsNot Nothing Then
clsBorderLines(0).intOuterLineWidth = clsOutsideLine.int100mmWidth
clsBorderLines(0).clr = clsOutsideLine.clr
End If
If clsInsideLine IsNot Nothing Then
clsBorderLines(1).intOuterLineWidth = clsInsideLine.int100mmWidth
clsBorderLines(1).clr = clsInsideLine.clr
End If
NOO.nfSetTableBorderLines(xtbl, clsBorderLines)
Return ""
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>set
TableCellParagraph
'''
[return]String =error content
''' </summary>
''' <param name="clsParagraphs">clsParagraph array</param>
''' <param name="objTableID">TableNO 1` or TableName</param>
''' <param name="intRowNO">RowNO 1`</param>
''' <param
name="intColumnNO">ColumnNO 1`</param>
''' <param name="chrInsertPlace">b=before,a=after,r=replace</param>
Public
Function nfSetTableCellParagraph _
(ByVal clsParagraphs() As
g_ctypParagraph _
, ByVal objTableID As Object _
, ByVal
intRowNO As Integer
_
, ByVal intColumnNO As Integer _
, Optional ByVal
chrInsertPlace As Char
= "b"c _
) As String
Try
Dim xtbl As
unoidl.com.sun.star.text.XTextTable = fGetTable(objTableID)
Dim xcellrng As
unoidl.com.sun.star.table.XCellRange = xtbl
If intColumnNO >
xtbl.getColumns.getCount Then
Return "*intColumnNO over "
& intColumnNO
End If
If intRowNO > xtbl.getRows.getCount Then
Return "*intRowNO over " &
intRowNO
End If
Dim xcell As
unoidl.com.sun.star.table.XCell = _
xcellrng.getCellByPosition(intColumnNO - 1, intRowNO - 1)
Dim xtxt As
unoidl.com.sun.star.text.XText = xcell
Dim xtcur As
unoidl.com.sun.star.text.XTextCursor = xtxt.createTextCursor
xtcur.gotoEnd(False)
Return fSetParagraphs(clsParagraphs _
, xtcur _
, chrInsertPlace _
, "" _
)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>get
TableCellParagraph
'''
[return]g_ctypParagraph()
''' </summary>
''' <param name="objTableID">TableNO 1` or TableName</param>
''' <param name="intRowNO">RowNO 1`</param>
''' <param name="intColumnNO">ColumnNO 1`</param>
Public
Function nfGetTableCellParagraph _
(ByVal objTableID As Object _
, ByVal intRowNO As Integer _
, ByVal intColumnNO As Integer _
) As g_ctypParagraph()
Try
Dim xtbl As
unoidl.com.sun.star.text.XTextTable = fGetTable(objTableID)
Dim xcellrng As
unoidl.com.sun.star.table.XCellRange = xtbl
If intColumnNO >
xtbl.getColumns.getCount Then
Return Nothing
End If
If intRowNO > xtbl.getRows.getCount Then
Return Nothing
End If
Dim xcell As
unoidl.com.sun.star.table.XCell = _
xcellrng.getCellByPosition(intColumnNO - 1, intRowNO - 1)
Dim xtxt As
unoidl.com.sun.star.text.XText = xcell
Dim xtcur As
unoidl.com.sun.star.text.XTextCursor = xtxt.createTextCursor
xtcur.gotoStart(False)
Return fGetParagraphs(xtcur)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
Private
Function fGetTable _
(ByVal objTableID As Object _
) As unoidl.com.sun.star.text.XTextTable
Try
Dim xtts As
unoidl.com.sun.star.text.XTextTablesSupplier = g_doc
Dim xna As
unoidl.com.sun.star.container.XNameAccess = _
xtts.getTextTables()
Dim xtbl As
unoidl.com.sun.star.text.XTextTable = Nothing
If objTableID.GetType Is GetType(String) Then
xtbl = xna.getByName(xna.getElementNames(objTableID)).Value
Else
xtbl = xna.getByName(xna.getElementNames(objTableID - 1)).Value
End If
Return xtbl
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>AddTableRow
'''
[return]String =error content
''' </summary>
''' <param name="objTableID">TableNO 1` or TableName</param>
''' <param name="intNumRows">1`</param>
''' <param name="intBeforeRowNO">BeforeRowNO 0=add</param>
Public
Function nfAddTableRow _
(ByVal objTableID As Object _
, ByVal intNumRows As Integer _
, Optional ByVal
intBeforeRowNO As Integer
= 0 _
) As
String
Try
If intNumRows < 1 Then
Return "*intNumRows error "
& intNumRows
End If
Dim xtbl As
unoidl.com.sun.star.text.XTextTable = fGetTable(objTableID)
Dim xtblRows As
unoidl.com.sun.star.table.XTableRows = xtbl.getRows()
If intBeforeRowNO = 0 Then
xtblRows.insertByIndex(xtblRows.getCount, intNumRows)
Else
xtblRows.insertByIndex(intBeforeRowNO - 1, intNumRows)
End If
Return ""
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>DeleteTable
'''
[return]integer deleted table count
''' </summary>
''' <param name="objTableID">TableNO 1` or TableName 0=All
Tables</param>
Public
Function nfDeleteTable _
(ByVal objTableID As Object _
) As Integer
Try
Dim xtts As
unoidl.com.sun.star.text.XTextTablesSupplier = g_doc
Dim xna As
unoidl.com.sun.star.container.XNameAccess = _
xtts.getTextTables()
Dim xtbl As
unoidl.com.sun.star.text.XTextTable = Nothing
If objTableID.GetType Is GetType(String) Then
xtbl = xna.getByName(objTableID).Value
xtbl.dispose()
Return 1
Else
If objTableID = 0 Then
For p1 As
Integer = 0 To
xna.getElementNames.Length - 1
xtbl = xna.getByName(xna.getElementNames(p1)).Value
xtbl.dispose()
Next
Return xna.getElementNames.Length
Else
xtbl = xna.getByName(xna.getElementNames(objTableID - 1)).Value
xtbl.dispose()
Return 1
End If
End If
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>GetTableNames
'''
[return]string()
''' </summary>
Public
Function nfGetTableNames _
( _
) As String()
Try
Dim xtts As
unoidl.com.sun.star.text.XTextTablesSupplier = g_doc
Dim xna As
unoidl.com.sun.star.container.XNameAccess = _
xtts.getTextTables()
Return xna.getElementNames
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>BookmarkNames
'''
[return]string()
''' </summary>
Public
Function nfGetBookmarkNames _
( _
) As String()
Try
Dim xbms As
unoidl.com.sun.star.text.XBookmarksSupplier = g_doc
Dim xna As
unoidl.com.sun.star.container.XNameAccess = xbms.getBookmarks
Return xna.getElementNames
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End Function
''' <summary>DeleteBookmark
'''
[return]string error content
''' </summary>
Public
Function nfDeleteBookmark _
(ByVal strBookmarkName As
String _
) As String
Try
Dim xbms As
unoidl.com.sun.star.text.XBookmarksSupplier = g_doc
Dim xna As
unoidl.com.sun.star.container.XNameAccess = xbms.getBookmarks
If xna.hasByName(strBookmarkName) = False Then
Return "* strBookmarkName error
" & strBookmarkName
End If
Dim xtc As
unoidl.com.sun.star.text.XTextContent = _
xna.getByName(strBookmarkName).Value
xtc.getAnchor.setString("")
xtc.dispose()
Return ""
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
DrawShape
''' </summary>
''' <param name="strFileName">FileName</param>
''' <param name="strName">Name</param>
''' <param name="npnt">Inser Point only Y orientation 1/100mm</param>
''' <param name="nsiz">nothing=Raw size 1/100mm</param>
''' <param name="intRotationAngle">clockwise angle</param>
''' <param name="strInsertPoint">null=End start=start xxxx=Bookmark</param>
Public
Function nfShapeDraw _
(ByVal strFileName As String _
, ByVal strName As String _
, Optional ByVal npnt As nNPoint = Nothing
_
, Optional ByVal nsiz As nNSize = Nothing _
, Optional ByVal
intRotationAngle As Integer
= 0 _
, Optional ByVal
strInsertPoint As String
= "" _
) As Boolean
Try
If NIO.nfFileExists(strFileName)
<> "" Then
NError.nfRaise(strFileName, "strFileName error")
End If
Dim xmsf As
unoidl.com.sun.star.lang.XMultiServiceFactory = g_doc
Dim xshp As
unoidl.com.sun.star.drawing.XShape = _
xmsf.createInstance("com.sun.star.drawing.GraphicObjectShape")
If strName <> "" Then
Dim xnamed As
unoidl.com.sun.star.container.XNamed = xshp
xnamed.setName(strName)
End If
Dim ngr As
New nNOOGraphic(g_nwriter, strFileName)
If nsiz Is
Nothing Then
xshp.setSize(ngr._awtsiz100thMM)
Else
xshp.setSize(NOO.nfToawtSize(nsiz.Size))
End If
'NOO._Property(xshp, "GraphicURL") =
NOO.nfFileToURL(strFileName)
NOO._objProperty(xshp, "Graphic") = ngr._Graphic
If intRotationAngle <> 0 Then
NOO._objProperty(xshp, "RotateAngle") = (360 -
intRotationAngle) * 100
End If
'NOO.nfPropertyDisplay(xshp)
If strInsertPoint <> "" Then
Dim xtxt As
unoidl.com.sun.star.text.XText = g_doc.getText
Dim xtcur As
unoidl.com.sun.star.text.XTextCursor = xtxt.createTextCursor
If strInsertPoint = "end" Then
xtcur.gotoEnd(False)
ElseIf strInsertPoint =
"start" Then
xtcur.gotoStart(False)
Else
Dim xtr As
unoidl.com.sun.star.text.XTextRange = _
fGetBookmarkRange(strInsertPoint)
If xtr Is
Nothing Then
Return False
End If
xtcur.gotoRange(xtr, False)
End If
Dim xtc As
unoidl.com.sun.star.text.XTextContent = xshp
xtxt.insertTextContent(xtcur, xtc, False)
Else
Dim xdps As
unoidl.com.sun.star.drawing.XDrawPageSupplier = _doc
Dim xdp As
unoidl.com.sun.star.drawing.XDrawPage = xdps.getDrawPage
xdp.add(xshp)
If npnt Is
Nothing Then
npnt = New nNPoint(0, 0)
End If
xshp.setPosition(NOO.nfToawtPoint(npnt.Point)) '0.01mm
End If
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return
Nothing
End Try
End
Function
Private
Function fGetBookmarkRange _
(ByVal strBookmarkName As
String _
) As unoidl.com.sun.star.text.XTextRange
Try
Dim xbms As
unoidl.com.sun.star.text.XBookmarksSupplier = g_doc
Dim xna As
unoidl.com.sun.star.container.XNameAccess = xbms.getBookmarks
'Dim strs() As String = xna.getElementNames
If xna.hasByName(strBookmarkName) = False Then
NError.nfRaise(strBookmarkName, "strBookmarkName error")
End If
Dim xtc As
unoidl.com.sun.star.text.XTextContent = _
xna.getByName(strBookmarkName).Value
Return xtc.getAnchor
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
ShapeDelete
''' </summary>
''' <param name="strName">Name null=all OLE</param>
Public
Function nfShapeDelete _
(ByVal strName As String _
) As Integer
Try
Dim xdps As
unoidl.com.sun.star.drawing.XDrawPageSupplier = _doc
Dim xdp As
unoidl.com.sun.star.drawing.XDrawPage = xdps.getDrawPage
Dim intCount As
Integer = 0
For p1 As
Integer = xdp.getCount - 1 To 0 Step -1
Dim xshp As
unoidl.com.sun.star.drawing.XShape = xdp.getByIndex(p1).Value
If
xshp.getShapeType.ToString.Contains("GraphicObjectShape") Then
Dim xnamed As
unoidl.com.sun.star.container.XNamed = xshp
'NSS.nfDW(xnamed.getName, "")
If strName <> "" Then
If NStr.nfCompare(xnamed.getName,
strName) = 0 Then
xdp.remove(xshp)
intCount += 1
End If
Else
xdp.remove(xshp)
intCount += 1
End If
End If
Next
Return intCount
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Dispatch
''' </summary>
''' <param name="strURL">URL after set ".uno:"</param>
''' <param name="pvs">array of PropertyValue</param>
Public
Function nfDispatch _
(ByVal strURL As String _
, Optional ByVal pvs() As unoidl.com.sun.star.beans.PropertyValue = Nothing _
) As Boolean
Try
If strURL = "" Then
NError.nfRaise("", "strURL=null error")
End If
Dim xfrm As
unoidl.com.sun.star.frame.XFrame = _CurrentController.getFrame
Dim pvs1() As
unoidl.com.sun.star.beans.PropertyValue = Nothing
If pvs Is
Nothing Then
pvs1 = New
unoidl.com.sun.star.beans.PropertyValue() {}
Else
pvs1 = pvs
End If
g_nwriter.g_xdh.executeDispatch(xfrm _
, ".uno:" & strURL _
, "" _
, 0 _
, pvs1 _
)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' save
Create or Open file
''' </summary>
''' <param name="strDocFile">DocFileName</param>
''' <param name="strPassword">Password</param>
''' <param name="blnReadOnly">true=ReadOnly</param>
''' <param name="blnOverwrite">true=overwrite</param>
''' <param name="blnDeleteBookmark">true=DeleteBookmark</param>
Public
Function nfSaveAs _
(ByVal strDocFile As String _
, Optional ByVal
strPassword As String
= "" _
, Optional ByVal
blnReadOnly As Boolean
= False _
, Optional ByVal
blnOverwrite As Boolean
= True _
, Optional ByVal
blnDeleteBookmark As Boolean
= False _
) As Boolean
Try
Dim strURL As
String = NIO.nfFilePathToFileURL(strDocFile)
If blnDeleteBookmark = True Then
Dim xbms As
unoidl.com.sun.star.text.XBookmarksSupplier = g_doc
Dim xna As
unoidl.com.sun.star.container.XNameAccess = xbms.getBookmarks
For p1 As
Integer = 0 To
xna.getElementNames.Length - 1
Dim xtc As
unoidl.com.sun.star.text.XTextContent = _
xna.getByName(xna.getElementNames(p1)).Value
xtc.dispose()
Next
End If
If NIO.nfFileExists(strDocFile) =
"" Then
If NIO.nfIsReadOnly(strDocFile) Then
NIO.nfRemovePathAttributes(strDocFile, IO.FileAttributes.ReadOnly)
End
If
End If
Dim npv As
New nNOOPropertyValue
If blnOverwrite = True Then
npv.nfAdd("Overwrite", True)
End If
g_strPassword = strPassword
Dim xstb As
unoidl.com.sun.star.frame.XStorable = g_doc
'MS Word
If strDocFile.EndsWith(".doc",
NConst.scOrdinalIC) Then
If strPassword <> "" Then
npv.nfAdd("Password", strPassword)
End If
npv.nfAdd("FilterName", "MS Word 97")
xstb.storeAsURL(strURL,
npv._PropertyValues)
'PDF
ElseIf
strDocFile.EndsWith(".pdf", NConst.scOrdinalIC) Then
Dim npv1 As
New nNOOPropertyValue
npv1.nfAdd("FilterName", "writer_pdf_Export")
If strPassword <> "" Then
Dim npv2 As
New nNOOPropertyValue()
npv2.nfAdd("EncryptFile", True)
npv2.nfAdd("DocumentOpenPassword", strPassword)
npv1.nfAdd("FilterData", npv2._PropertyValues)
End If
xstb.storeToURL(strURL, npv1._PropertyValues)
'ODT
Else
If strPassword <> "" Then
npv.nfAdd("Password", strPassword)
End If
xstb.storeAsURL(strURL, npv._PropertyValues)
End If
If blnReadOnly = True Then
NIO.nfAddPathAttributes(strDocFile, IO.FileAttributes.ReadOnly)
End If
g_strCurrentDocFile = strDocFile
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' save
Open file
''' </summary>
''' <param name="strPassword">Password</param>
''' <param name="blnReadOnly">true=ReadOnly</param>
''' <param name="blnDeleteBookmark">true=DeleteBookmark</param>
Public
Function nfSave _
(Optional ByVal
strPassword As String
= "" _
, Optional ByVal
blnReadOnly As Boolean
= False _
, Optional ByVal
blnDeleteBookmark As Boolean
= False _
) As Boolean
Try
If g_strDocFile = "" Then
NError.nfRaise("", "not yet Open")
End If
nfSaveAs(g_strDocFile _
, strPassword _
, blnReadOnly _
, _
, blnDeleteBookmark _
)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
close Open file
''' </summary>
Public
Function nfClose _
( _
) As Boolean
Try
g_nwriter.nfDocClose(Me)
g_doc = Nothing
If NStr.nfCompare(g_strDocFile,
g_strCurrentDocFile) <> 0 AndAlso _
g_blnCreate = True Then
NIO.nfDelete(g_strDocFile)
End If
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Print
''' </summary>
''' <param name="strPrinterName">PrinterName</param>
''' <param name="shtNumCopies">NumCopies</param>
Public
Function nfPrint _
(Optional ByVal
strPrinterName As String
= "" _
, Optional ByVal
shtNumCopies As Short
= 1 _
) As Boolean
Try
Dim nprinter As
New nNOOPrinter(g_doc)
Return nprinter.nfPrint(strPrinterName,
shtNumCopies)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
PageHeaderFooter
''' <para>[exp]&p=PageNO</para>
''' <para>&n=PageCount</para>
''' <para>&d=Date</para>
''' <para>&t=Time</para>
''' <para>&c=ComputerName</para>
''' <para>&f=FileName</para>
''' <para>&T=Title</para>
''' </summary>
''' <param name="strData">default=Page:p/n
Date:d t
SystemInformation.ComputerName</param>
''' <param name="chrPlace">l=left,c=center,r=right</param>
''' <param name="blnHeader">true=header false=footer</param>
''' <param name="strStyleName">StyleName</param>
Public
Function nfSetPageHeaderFooter _
(ByVal strData As String _
, Optional ByVal
chrPlace As Char
= "r"c _
, Optional ByVal
blnHeader As Boolean
= True _
, Optional ByVal
strStyleName As String
= "Standard" _
) As Boolean
Try
'xtc.setString("")
If strData = "" Then
If blnHeader = True
Then
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.HeaderIsOn, strStyleName) = False
Else
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.FooterIsOn,
strStyleName) = False
End If
Return True
ElseIf NStr.nfCompare(strData,
"default") = 0 Then
strData = "Page:&p/&n
Date:&d &t &c"
End If
Dim xmsf As
unoidl.com.sun.star.lang.XMultiServiceFactory = g_doc
'Dim strs() As String =
xmsf.getAvailableServiceNames()
'Array.Sort(strs)
'NMsgBox.nfShow(strs)
Dim xtxt As
unoidl.com.sun.star.text.XText = Nothing
If blnHeader = True Then
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.HeaderIsOn, strStyleName) = True
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.HeaderIsDynamicHeight,
strStyleName) = True
xtxt = _objPageSetupPpt(NOO.enmWrtrPageSetupPpt.HeaderText,
strStyleName)
Else
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.FooterIsOn, strStyleName) = True
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.FooterIsDynamicHeight,
strStyleName) = True
xtxt = _objPageSetupPpt(NOO.enmWrtrPageSetupPpt.FooterText,
strStyleName)
End If
Dim xtc As
unoidl.com.sun.star.text.XTextCursor = xtxt.createTextCursor()
If chrPlace = "c"c OrElse _
chrPlace = "r"c Then
Dim intWidth As
Integer = _
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.Width, strStyleName)
Dim intLeftMargin As Integer = _
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.LeftMargin, strStyleName)
Dim intRightMargin As Integer = _
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.RightMargin, strStyleName)
Dim ts As
New unoidl.com.sun.star.style.TabStop
If chrPlace = "c"c Then
ts.Position = (intWidth - intLeftMargin - intRightMargin) / 2
ts.Alignment = unoidl.com.sun.star.style.TabAlign.CENTER
Else
ts.Position = intWidth - intLeftMargin - intRightMargin
ts.Alignment = unoidl.com.sun.star.style.TabAlign.RIGHT
End If
Dim tss(0) As
unoidl.com.sun.star.style.TabStop
tss(0) = ts
NOO._objProperty(xtc, "ParaTabStops") = tss
xtxt.insertString(xtc, vbTab, False)
End If
strData = strData.Replace("&&", vbTab)
Dim pStart As
Integer = 0
Dim px As
Integer = 0
Do
If px > strData.Length - 1 Then
Exit Do
End If
If strData.Chars(px) = "&"
Then
If px < strData.Length - 1 Then
If strData.Chars(px + 1) =
"p"c OrElse _
strData.Chars(px + 1) = "n"c OrElse
_
strData.Chars(px + 1) = "d"c OrElse
_
strData.Chars(px + 1) = "t"c OrElse
_
strData.Chars(px
+ 1) = "c"c OrElse _
strData.Chars(px + 1) = "f"c OrElse
_
strData.Chars(px + 1) = "T"c Then
If px <> pStart Then
xtc.gotoEnd(False)
xtxt.insertString(xtc
_
, strData.Substring(pStart, px - pStart) _
.Replace(vbTab, "&") _
, False _
)
Dim xtc1 As
unoidl.com.sun.star.text.XTextContent = Nothing
If strData.Chars(px + 1) =
"p"c Then
xtc1 = _
xmsf.createInstance("com.sun.star.text.TextField.PageNumber")
NOO._objProperty(xtc1, "NumberingType") = _
unoidl.com.sun.star.style.NumberingType.ARABIC
NOO._objProperty(xtc1, "SubType") = _
unoidl.com.sun.star.text.PageNumberType.CURRENT
xtxt.insertTextContent(xtc, xtc1, True)
ElseIf strData.Chars(px + 1) =
"n"c Then
xtc1 = _
xmsf.createInstance("com.sun.star.text.TextField.PageCount")
NOO._objProperty(xtc1, "NumberingType") = _
unoidl.com.sun.star.style.NumberingType.ARABIC
xtxt.insertTextContent(xtc, xtc1, False)
ElseIf strData.Chars(px + 1) =
"d"c Then
'Date format is "mm/dd/yy", so
substitute Now.ToShortDateString
'xtc1 = _
'
xmsf.createInstance("com.sun.star.text.TextField.DateTime")
''NOO.nfPropertyDisplay(xtc1)
'NOO._Property(xtc1, "IsDate") =
True
'xtxt.insertTextContent(xtc, xtc1, False)
xtxt.insertString(xtc _
, Now.ToShortDateString _
, False _
)
ElseIf strData.Chars(px + 1) =
"t"c Then
xtc1 = _
xmsf.createInstance("com.sun.star.text.TextField.DateTime")
NOO._objProperty(xtc1, "IsDate") = False
xtxt.insertTextContent(xtc,
xtc1, True)
ElseIf strData.Chars(px + 1) =
"c"c Then
xtxt.insertString(xtc _
, SystemInformation.ComputerName _
,
False _
)
ElseIf strData.Chars(px + 1) =
"f"c Then
xtc1 = _
xmsf.createInstance("com.sun.star.text.TextField.FileName")
xtxt.insertTextContent(xtc, xtc1, False)
ElseIf strData.Chars(px + 1) =
"T"c Then
xtc1 = _
xmsf.createInstance("com.sun.star.text.TextField.DocInfo.Title")
xtxt.insertTextContent(xtc, xtc1, False)
End If
px += 2
pStart = px
Continue Do
End If
End If
End If
End If
px += 1
Loop
If px <> pStart Then
xtc.gotoEnd(False)
xtxt.insertString(xtc _
, strData.Substring(pStart, px - pStart).Replace(vbTab,
"&") _
, False _
)
End If
'analize of content(uncomplete)
'If blnHeader = False OrElse chrPart <>
"r"c Then
'
Exit Property
'End If
'Dim xt As XText = xhfc.getRightText
'Dim xtfs As XTextFieldsSupplier = xt
'Dim x As XTextEmbeddedObjectsSupplier = xhfc
'Dim x As XFlatParagraphIteratorProvider =
xhfc
'Dim xna As XNameAccess = xtfs.getTextFieldMasters()
'Dim strs1() As String = xna.getElementNames
'Dim xea As XEnumerationAccess =
xtfs.getTextFields()
'Dim enm As XEnumeration =
xea.createEnumeration
'While enm.hasMoreElements
'
Dim any As uno.Any = enm.nextElement
'
Dim tf As XTextField = any.Value
'
'Dim tc As XTextContent = any.Value
'
Dim xtr As XTextRange = tf.getAnchor
'
Dim str2 As String = xtr.getString()
'
Dim str1 As String = tf.getPresentation(True)
'
'NOO.nfPropertyDisplay(any.Value)
'
Dim xsi As XServiceInfo = tf
'
Dim str As String = xsi.getImplementationName
'
Dim strs() As String = xsi.getSupportedServiceNames
'End While
'Dim xt As XText = xhfc.getRightText
'Dim xtts As XTextFieldsSupplier = xt
'Dim xna As XNameAccess = xtts.getTextFields()
'Dim strEles() As String = xna.getElementNames
'For p1 As Integer = 0 To strEles.Length - 1
'
Dim a As uno.Any = xna.getByName(strEles(p1))
'Next
'Dim xi As XIndexAccess = xea
'For p1 As Integer = 0 To xi.getCount - 1
'
Dim any As uno.Any = xi.getByIndex(p1)
'
Dim xtf As XTextField = any.Value
'Next
'Dim xtc1 As XTextCursor =
xhfc.getRightText.createTextCursor
'xtc1.gotoStart(False)
'xtc1.goRight(12, True)
'Dim xtx As XText = xtc1.getText
'Dim str As String = xtc1.getString
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
IsAlive
''' </summary>
Public
Function nfIsAlive _
( _
) As Boolean
Try
Dim xmdl As
unoidl.com.sun.star.frame.XModel = g_doc
Dim xc As
unoidl.com.sun.star.frame.XController = xmdl.getCurrentController
Return True
Catch ex As Exception
Return False
End Try
End
Function
''' <summary>
'''
diplay of Doc
''' </summary>
''' <param name="blnWaitForExit">true=WaitForExit</param>
Public
Function nfDisplay _
(Optional ByVal
blnWaitForExit As Boolean
= False _
) As Boolean
Try
If g_doc IsNot
Nothing Then
nfClose()
End If
If
g_strCurrentDocFile.EndsWith(".doc", NConst.scOrdinalIC) Then
Dim ndoc As
nNWriterDoc = _
g_nwriter.nfDocOpen(g_strCurrentDocFile, g_strPassword, False)
ndoc.nfSave()
Do
Application.DoEvents()
If ndoc.nfIsAlive = False Then
Exit Do
End If
Loop
Return True
End If
Application.DoEvents()
Dim prc As
New Process
prc.StartInfo.WindowStyle = ProcessWindowStyle.Normal
prc.StartInfo.FileName = g_strCurrentDocFile
prc.StartInfo.Arguments = ""
prc.Start()
If blnWaitForExit = True Then
prc.WaitForExit()
prc.Dispose()
End If
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' Doc
FontName
''' </summary>
<Browsable(False)> _
Public
Property _strDocFontName _
( _
) As String
Get
Return
_objProperty(NOO.enmWrtrDocPpt.CharFontNameAsian)
End Get
Set(ByVal value As String)
Try
_objProperty(NOO.enmWrtrDocPpt.CharFontName) = value
_objProperty(NOO.enmWrtrDocPpt.CharFontNameAsian) = value
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
''' Doc
FontSize(point)
''' </summary>
<Browsable(False)> _
Public
Property _sngDocFontSize _
( _
) As Single
Get
Dim xtxt As
unoidl.com.sun.star.text.XText = g_doc.getText
Dim xtcur As
unoidl.com.sun.star.text.XTextCursor = xtxt.createTextCursor
'NOO.nfPropertyDisplay(xtcur)
Return NOO._objProperty(xtcur,
"CharHeight")
End Get
Set(ByVal value As Single)
Dim xtxt As
unoidl.com.sun.star.text.XText = g_doc.getText
Dim xtcur As
unoidl.com.sun.star.text.XTextCursor = xtxt.createTextCursor
NOO._objProperty(xtcur, "CharHeight") = value
NOO._objProperty(xtcur, "CharHeightAsian") = value
End Set
End
Property
''' <summary>
''' Doc
FontStyle
''' </summary>
<Browsable(False)> _
Public
Property _fsDocFontStyle _
( _
) As FontStyle
Get
Dim fs As
New FontStyle
Dim xtxt As
unoidl.com.sun.star.text.XText = g_doc.getText
Dim xtcur As
unoidl.com.sun.star.text.XTextCursor = xtxt.createTextCursor
If NOO._objProperty(xtcur,
"CharPosture") = unoidl.com.sun.star.awt.FontSlant.ITALIC Then
fs = fs Or FontStyle.Italic
End If
If NOO._objProperty(xtcur,
"CharWeight") > 100 Then
fs = fs Or FontStyle.Bold
End If
If NOO._objProperty(xtcur,
"CharStrikeout") <> 0 Then
fs = fs Or FontStyle.Strikeout
End If
If NOO._objProperty(xtcur,
"CharUnderline") <> 0 Then
fs = fs Or FontStyle.Underline
End If
Return fs
End Get
Set(ByVal value As FontStyle)
Try
Dim xtxt As
unoidl.com.sun.star.text.XText = g_doc.getText
Dim xtcur As
unoidl.com.sun.star.text.XTextCursor = xtxt.createTextCursor
If (value And
FontStyle.Strikeout) <> 0 Then
NOO._objProperty(xtcur, "CharStrikeout") = _
NSS.nfCInt(NOO.enmFontStrikeout.SINGLE)
Else
NOO._objProperty(xtcur,
"CharStrikeout") = 0
End If
If (value And
FontStyle.Underline) <> 0 Then
NOO._objProperty(xtcur, "CharUnderline") = _
NSS.nfCInt(NOO.enmFontStrikeout.SINGLE)
Else
NOO._objProperty(xtcur, "CharStrikeout") = 0
End If
If (value And
FontStyle.Bold) <> 0 Then
NOO._objProperty(xtcur, "CharWeight") = 200
NOO._objProperty(xtcur, "CharWeightAsian") = 200
Else
NOO._objProperty(xtcur, "CharWeight") = 100
NOO._objProperty(xtcur, "CharWeightAsian") = 100
End If
If (value And
FontStyle.Italic) <> 0 Then
NOO._objProperty(xtcur, "CharPosture") =
unoidl.com.sun.star.awt.FontSlant.ITALIC
NOO._objProperty(xtcur, "CharPostureAsian") =
unoidl.com.sun.star.awt.FontSlant.ITALIC
Else
NOO._objProperty(xtcur, "CharPosture") = 0
NOO._objProperty(xtcur, "CharPostureAsian") = 0
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
''' Doc
Font
''' </summary>
<Browsable(False)> _
Public
Property _fntDoc _
( _
) As Font
Get
Return New
Font(_strDocFontName, _sngDocFontSize, _fsDocFontStyle)
End Get
Set(ByVal value As Font)
Try
_strDocFontName = value.Name
_sngDocFontSize = value.Size
_fsDocFontStyle = value.Style
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
''' Doc
Font Color
''' </summary>
<Browsable(False)> _
Public
Property _clrDocFont _
( _
) As Color
Get
Dim xtxt As
unoidl.com.sun.star.text.XText = g_doc.getText
Dim xtcur As
unoidl.com.sun.star.text.XTextCursor = xtxt.createTextCursor
'NOO.nfPropertyDisplay(xtcur)
Return
Color.FromArgb(NOO._objProperty(xtcur, "CharColor"))
End Get
Set(ByVal value As Color)
Dim xtxt As
unoidl.com.sun.star.text.XText = g_doc.getText
Dim xtcur As
unoidl.com.sun.star.text.XTextCursor = xtxt.createTextCursor
NOO._objProperty(xtcur, "CharColor") = RGB(value.B, value.G,
value.R)
End Set
End
Property
''' <summary>
'''
PrinterName
''' </summary>
<Browsable(False)> _
Public
Property _strPrinterName _
( _
) As String
Get
Dim nprinter As
New nNOOPrinter(g_doc)
Return nprinter._strPrinterName
End Get
Set(ByVal Value As String)
Try
Dim nprinter As
New nNOOPrinter(g_doc)
nprinter._strPrinterName = Value
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
PrinterPaperTray ex)Auto
''' </summary>
<Browsable(False)> _
Public
Property _strPrinterPaperTray _
( _
) As String
Get
Return
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.PrinterPaperTray)
End Get
Set(ByVal Value As String)
Try
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.PrinterPaperTray) = Value
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
PaperSizeName(set after add Sheet) A4,A5
''' </summary>
<Browsable(False)> _
Public
Property _enmPaperSizeName _
( _
) As NOO.enmPaperSizeName
Get
'Dim xpb As XPrintable = g_doc
'Dim pvs() As PropertyValue = xpb.getPrinter
'Dim pf As PaperFormat = 0
'For p1 As Integer = 0 To pvs.Length - 1
'
If pvs(p1).Name = "PaperFormat" Then
' pf =
pvs(p1).Value.Value
'
NSS.nfDW(pf.ToString, "PaperFormat")
'
End If
'
If pvs(p1).Name = "PaperSize" Then
' NSS.nfDW(NOO.nfToDrawingSize(pvs(p1).Value.Value),
"PaperSize")
'
NSS.nfDW(NOO.nfToDrawingSize(_PageSetupProperty(NOO.WriterPageSetupPpt.Size)))
'
End If
'Next
Dim sizf As
SizeF = _
NOO.nfToDrawingSize(_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.Size))
If _enmPageOrientation =
NOO.enmPageOrientation.Landscape Then
sizf = New Size(sizf.Height, sizf.Width)
End If
For p1 As
Integer = 0 To
NOO.strPaperMMs.Length - 1
Dim strs() As
String = NStr.nfSplit(NOO.strPaperMMs(p1) _
, " *" _
, Nothing _
, _
,
3 _
)
'comapre under 1mm
If Math.Abs(strs(1) - sizf.Width) < 1
AndAlso _
Math.Abs(strs(2) - sizf.Height / 100) < 1 Then
Return p1
End If
Next
Return NOO.enmPaperSizeName.User
End Get
Set(ByVal Value As NOO.enmPaperSizeName)
Try
'Dim xpb As XPrintable = g_doc
'Dim pvs() As PropertyValue = xpb.getPrinter
'For p1 As Integer = 0 To pvs.Length - 1
'
If pvs(p1).Name = "CanSetPaperFormat" Then
' If
pvs(p1).Value.Value = False Then
'
NError.nfRaise("", "CanSetPaperFormat=false error")
' End If
' End If
'Next
'For p1 As Integer = 0 To pvs.Length - 1
'
If pvs(p1).Name = "PaperFormat" Then
' 'pvs(p1).Value =
New uno.Any(GetType(PaperFormat), Value)
' 'ElseIf
pvs(p1).Name = "PaperSize" Then
' ' If Value = NOO.PaperFormat.USER
Then
' ' pvs(p1).Value =
New uno.Any(GetType(unoidl.com.sun.star.awt.Size) _
' '
, NOO.nfToawtSize(New Size(100, 200)) _
' '
)
' ' End If
'
End If
'Next
'xpb.setPrinter(pvs)
For p1 As
Integer = 0 To
NOO.strPaperMMs.Length - 1
Dim strs() As
String = NStr.nfSplit(NOO.strPaperMMs(p1) _
, " *" _
, Nothing _
, _
,
3 _
)
If NStr.nfCompare(strs(0),
Value.ToString) = 0 Then
If _enmPageOrientation =
NOO.enmPageOrientation.Portrait Then
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.Size) = _
New
unoidl.com.sun.star.awt.Size(NSS.nfCInt(strs(1)) * 100 _
, NSS.nfCInt(strs(2)) * 100 _
)
Else
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.Size) = _
New
unoidl.com.sun.star.awt.Size(NSS.nfCInt(strs(2)) * 100 _
, NSS.nfCInt(strs(1)) * 100 _
)
End If
Exit Property
End If
Next
NError.nfRaise(Value, "NOO.PaperSizeName error")
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
PaperSize
''' </summary>
<Browsable(False)> _
Public
Property _sizPaperSize _
( _
) As Size
Get
Return
NOO.nfToDrawingSize(_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.Size))
End Get
Set(ByVal Value As Size)
Try
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.Size) = NOO.nfToawtSize(Value)
Catch ex As
Exception
NError.nfShow(ex,
Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
PageOrientation
''' </summary>
<Browsable(False)> _
Public
Property _enmPageOrientation _
( _
) As NOO.enmPageOrientation
Get
Dim sizf As
SizeF = _
NOO.nfToDrawingSize(_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.Size))
If sizf.Width > sizf.Height Then
Return NOO.enmPageOrientation.Landscape
Else
Return NOO.enmPageOrientation.Portrait
End If
End Get
Set(ByVal Value As NOO.enmPageOrientation)
Try
Dim nprinter As
New nNOOPrinter(g_doc)
nprinter.nfSetPageOrientation(Value)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
LeftMargin
''' </summary>
''' <param name="blnInch">true=Inch false=mm</param>
<Browsable(False)> _
Public
Property _sngLeftMargin _
(Optional ByVal
blnInch As Boolean
= True _
) As Single
Get
Dim intMM As
Integer = _
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.LeftMargin)
If blnInch = True
Then
Return intMM / 100 / 25.4
Else
Return intMM / 100
End If
End Get
Set(ByVal Value As Single)
Try
If blnInch = False
Then
Value *= 100
Else
Value *= 100 * 25.4
End If
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.LeftMargin) = NSS.nfCInt(Value)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
TopMargin
''' </summary>
''' <param name="blnInch">true=Inch false=mm</param>
<Browsable(False)> _
Public
Property _sngTopMargin _
(Optional ByVal
blnInch As Boolean
= True _
) As Single
Get
Dim intMM As
Integer = _
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.TopMargin)
If blnInch = True
Then
Return intMM / 100 / 25.4
Else
Return intMM / 100
End If
End Get
Set(ByVal Value As Single)
Try
If blnInch = False
Then
Value *= 100
Else
Value *= 100 * 25.4
End If
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.TopMargin) = NSS.nfCInt(Value)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
RightMargin
''' </summary>
''' <param name="blnInch">true=Inch false=mm</param>
<Browsable(False)> _
Public
Property _sngRightMargin _
(Optional ByVal
blnInch As Boolean
= True _
) As Single
Get
Dim intMM As
Integer = _
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.RightMargin)
If blnInch = True
Then
Return intMM / 100 / 25.4
Else
Return intMM / 100
End If
End Get
Set(ByVal Value As Single)
Try
If blnInch = False
Then
Value *= 100
Else
Value *= 100 * 25.4
End If
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.RightMargin) =
NSS.nfCInt(Value)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
BottomMargin
''' </summary>
''' <param name="blnInch">true=Inch false=mm</param>
<Browsable(False)> _
Public
Property _sngBottomMargin _
(Optional ByVal
blnInch As Boolean
= True _
) As Single
Get
Dim intMM As
Integer = _
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.BottomMargin)
If blnInch = True
Then
Return intMM / 100 / 25.4
Else
Return intMM / 100
End If
End Get
Set(ByVal Value As Single)
Try
If blnInch = False
Then
Value *= 100
Else
Value *= 100 * 25.4
End If
_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.BottomMargin) =
NSS.nfCInt(Value)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
Property
''' </summary>
<Browsable(False)> _
Public
Property _objProperty _
(ByVal enm As
NOO.enmWrtrDocPpt _
) As Object
Get
Dim strPropertyName As String =
[Enum].GetName(GetType(NOO.enmWrtrDocPpt), enm)
Dim ps As
unoidl.com.sun.star.beans.XPropertySet = g_doc
If
ps.getPropertySetInfo.hasPropertyByName(strPropertyName) = True Then
Return
ps.getPropertyValue(strPropertyName).Value
End If
NError.nfRaise(strPropertyName,
"strPropertyName error")
Return Nothing
End Get
Set(ByVal value As Object)
Try
Dim strPropertyName As String =
[Enum].GetName(GetType(NOO.enmWrtrDocPpt), enm)
Dim ps As
unoidl.com.sun.star.beans.XPropertySet = g_doc
If
ps.getPropertySetInfo.hasPropertyByName(strPropertyName) = True Then
ps.setPropertyValue(strPropertyName _
, New uno.Any(value.GetType, value) _
)
Else
NError.nfRaise(strPropertyName, "strPropertyName error")
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
PageSetup Property
''' </summary>
<Browsable(False)> _
Public
Property _objPageSetupPpt _
(ByVal enm As
NOO.enmWrtrPageSetupPpt _
, Optional ByVal
strStyleName As String
= "Standard" _
) As Object
Get
Dim strPropertyName As String = _
[Enum].GetName(GetType(NOO.enmWrtrPageSetupPpt),
enm)
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("PageStyles").Value
Dim xps As
unoidl.com.sun.star.beans.XPropertySet = _
xnc.getByName(strStyleName).Value
If
xps.getPropertySetInfo.hasPropertyByName(strPropertyName) = True Then
Return
xps.getPropertyValue(strPropertyName).Value
End If
NError.nfRaise(strPropertyName, "strPropertyName error")
Return Nothing
End Get
Set(ByVal value As Object)
Try
Dim strPropertyName As String = _
[Enum].GetName(GetType(NOO.enmWrtrPageSetupPpt),
enm)
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("PageStyles").Value
Dim xps As
unoidl.com.sun.star.beans.XPropertySet = _
xnc.getByName(strStyleName).Value
If
xps.getPropertySetInfo.hasPropertyByName(strPropertyName) = True Then
xps.setPropertyValue(strPropertyName _
, New uno.Any(value.GetType, value) _
)
Else
NError.nfRaise(strPropertyName, "strPropertyName error")
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
CurrentController
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_CurrentController _
( _
) As unoidl.com.sun.star.frame.XController
Get
Dim xmdl As
unoidl.com.sun.star.frame.XModel = g_doc
Return xmdl.getCurrentController
End Get
End
Property
''' <summary>
'''
Visible
''' </summary>
<Browsable(False)> _
Public
Property _blnVisible _
( _
) As Boolean
Get
Dim xfrm As
unoidl.com.sun.star.frame.XFrame = _CurrentController.getFrame
Dim xwnd2 As
unoidl.com.sun.star.awt.XWindow2 = xfrm.getContainerWindow
Return xwnd2.isVisible
End Get
Set(ByVal Value As Boolean)
Try
Dim xfrm As
unoidl.com.sun.star.frame.XFrame = _CurrentController.getFrame
Dim xwnd As
unoidl.com.sun.star.awt.XWindow = xfrm.getContainerWindow
xwnd.setVisible(Value)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
PageStyleNames
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_strPageStyleNames _
( _
) As String()
Get
Dim xfs As
unoidl.com.sun.star.style.XStyleFamiliesSupplier = g_doc
Dim xnc As
unoidl.com.sun.star.container.XNameContainer = _
xfs.getStyleFamilies.getByName("PageStyles").Value
Return xnc.getElementNames
End Get
End
Property
''' <summary>
'''
XTextDocument
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_doc _
( _
) As unoidl.com.sun.star.text.XTextDocument
Get
Return g_doc
End Get
End
Property
''' <summary>
'''
Bookmarks
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_strBookmarks _
( _
) As String()
Get
Dim xbms As
unoidl.com.sun.star.text.XBookmarksSupplier = g_doc
Return
xbms.getBookmarks.getElementNames()
End Get
End
Property
''' <summary>
'''
UserArea rectangle
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_rctUserArea _
( _
) As Rectangle
Get
Dim rct As
Rectangle = Nothing
rct.X = _objPageSetupPpt(NOO.enmWrtrPageSetupPpt.LeftMargin)
rct.Y = _objPageSetupPpt(NOO.enmWrtrPageSetupPpt.TopMargin)
Dim siz As Size = _
NOO.nfToDrawingSize(_objPageSetupPpt(NOO.enmWrtrPageSetupPpt.Size))
rct.Width = siz.Width - rct.X _
- _objPageSetupPpt(NOO.enmWrtrPageSetupPpt.RightMargin)
rct.Height = siz.Height - rct.Y _
- _objPageSetupPpt(NOO.enmWrtrPageSetupPpt.BottomMargin)
Return rct
End Get
End
Property
End Class
5-1.nNBase
Imports System.ComponentModel
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
''' <summary>
''' Open Office Base
''' </summary>
Public Class nNBase
'Private
g_xodd As unoidl.com.sun.star.sdb.XOfficeDatabaseDocument
Public
g_con As unoidl.com.sun.star.sdbc.XConnection
Private
g_xs As unoidl.com.sun.star.sdbc.XStatement
Private
g_strVersion As String
= ""
Private
g_strDBFileName As String
= ""
Public
g_xcc As
unoidl.com.sun.star.uno.XComponentContext
Public
g_xmsf As
unoidl.com.sun.star.lang.XMultiServiceFactory
Public
g_xdesktop As unoidl.com.sun.star.frame.XDesktop
Public
g_xdh As
unoidl.com.sun.star.frame.XDispatchHelper = Nothing
Public
g_xodd As
unoidl.com.sun.star.sdb.XOfficeDatabaseDocument
Public
Sub New _
( _
)
Try
g_xcc = uno.util.Bootstrap.bootstrap
g_xmsf = g_xcc.getServiceManager
g_xdesktop =
g_xmsf.createInstance("com.sun.star.frame.Desktop")
g_xdh =
g_xmsf.createInstance("com.sun.star.frame.DispatchHelper")
'Dim strs() As String = xmsf.getAvailableServiceNames()
'Array.Sort(strs)
'NMsgBox.nfShow(strs)
'Dim XCP As
unoidl.com.sun.star.lang.XMultiServiceFactory = _
'
xmsf.createInstance("com.sun.star.configuration.ConfigurationProvider")
'Dim stb As New StringBuilder
'fDisplayConfig(0,
"/org.openoffice.Office.Paths/Paths", XCP, stb)
'NMsgBox.nfShow(stb.ToString)
''Dim params(0) As uno.Any
''params(0) = New
uno.Any(GetType(unoidl.com.sun.star.beans.PropertyValue) _
''
, New unoidl.com.sun.star.beans.PropertyValue("nodepath" _
''
, 0 _
''
, New uno.Any("/org.openoffice.Setup/Product") _
''
,
unoidl.com.sun.star.beans.PropertyState.DEFAULT_VALUE _
''
) _
''
)
'Dim args(0) As uno.Any
'args(0) = New uno.Any(GetType(unoidl.com.sun.star.beans.PropertyValue)
_
'
, New unoidl.com.sun.star.beans.PropertyValue _
'
("nodepath" _
'
, 0 _
'
, New uno.Any("/org.openoffice.Office.Paths/Paths/Help") _
'
, unoidl.com.sun.star.beans.PropertyState.DEFAULT_VALUE _
'
) _
'
)
'Dim xna As unoidl.com.sun.star.container.XNameAccess
= _
'
XCP.createInstanceWithArguments _
'
("com.sun.star.configuration.ConfigurationAccess", args)
'Dim strs() As String = xna.getElementNames
'For p1 As Integer = 0 To strs.Length - 1
'
Dim any As uno.Any = xna.getByName(strs(p1))
'
If any.Value Is Nothing Then
'
End If
'
'Dim x As unoidl.com.sun.star.container.XHierarchicalNameAccess =
any.Value
'
'Dim str1 As String = x.getByHierarchicalName()
'Next
'g_strVersion =
xna.getByName("ooSetupVersion").Value.ToString
'Dim oSM As Object =
CreateObject("com.sun.star.ServiceManager")
'Dim oDesktop As Object =
oSM.createInstance("com.sun.star.frame.Desktop")
''Dim npv As New
nNOOPropertyValue("Hidden", True)
'Dim npv As New nNOOPropertyValue()
'New
'Dim oDoc As Object = _
'
oDeskTop.loadComponentFromURL("private:factory/sdatabase" _
'
, "_blank" _
'
, 0 _
'
, npv._PropertyValues _
'
)
'Dim strURL As String =
NOO.nfFileToURL("c:\nsstemp\VKf[^x[X3.odb")
'Dim oDoc As Object = _
'
oDeskTop.loadComponentFromURL(strURL _
'
, "_hidden" _
'
, 0 _
'
, npv._PropertyValues _
' )
'Dim dc As Object = _
'
xmsf.createInstance("com.sun.star.sdb.DatabaseContext")
'Dim xna1 As
unoidl.com.sun.star.container.XNameAccess = dc
'Dim strDataSourceNames() As String =
xna1.getElementNames()
'Dim any As Object = xna1.getByName(strURL)
'Dim xds As
unoidl.com.sun.star.sdbc.XDataSource = any.Value
'oDoc.CurrentController.Frame.Close(True)
'oDoc.dispose()
'get Version
Dim XConfigurationProvider As unoidl.com.sun.star.lang.XMultiServiceFactory = _
g_xmsf.createInstance("com.sun.star.configuration.ConfigurationProvider")
Dim params(0) As
uno.Any
params(0) = New uno.Any(GetType(unoidl.com.sun.star.beans.PropertyValue) _
, New
unoidl.com.sun.star.beans.PropertyValue("nodepath" _
, 0 _
, New
uno.Any("/org.openoffice.Setup/Product") _
, unoidl.com.sun.star.beans.PropertyState.DEFAULT_VALUE _
) _
)
Dim xna As
unoidl.com.sun.star.container.XNameAccess = _
XConfigurationProvider.createInstanceWithArguments _
("com.sun.star.configuration.ConfigurationAccess", params)
g_strVersion = xna.getByName("ooSetupVersion").Value.ToString
Catch ex As Exception
NError.nfShow(ex, Err.Number)
End Try
End
Sub
''' <summary>
'''
DBConnect
''' </summary>
''' <param name="strDBFileName">DBFileName</param>
''' <param name="strUser">user</param>
''' <param name="strPassword">Password</param>
Public
Function nfDBConnect _
(ByVal strDBFileName As
String _
, Optional ByVal
strUser As String
= "" _
, Optional ByVal
strPassword As String
= "" _
) As String
Try
'Dim xna As
unoidl.com.sun.star.container.XNameAccess = _
'g_xmsf.createInstance("com.sun.star.sdb.DatabaseContext")
'ÔÚ@
'Dim strDataSourceNames() As String =
xna.getElementNames()
'For p1 As Integer = 0 To
strDataSourceNames.Length - 1
'
Dim xds As unoidl.com.sun.star.sdbc.XDataSource = Nothing
'
Dim strError As String = _
'
fGetDataSource(strDataSourceNames(p1), xna, xds)
'
If strError = "" Then
' Dim xdd As
unoidl.com.sun.star.sdb.XDocumentDataSource = xds
' Dim xodd As
unoidl.com.sun.star.sdb.XOfficeDatabaseDocument = _
'
xdd.DatabaseDocument
' Dim xmdl As
unoidl.com.sun.star.frame.XModel = xodd
' Dim str As
String = NOO.nfURLToFile(g_xcc, xmdl.getURL())
'
'NOO.nfPropertyDisplay(xds)
' 'Dim pvs() As
unoidl.com.sun.star.beans.PropertyValue = _
' ' NOO._objProperty(xds,
"Info")
' 'Dim ps As
unoidl.com.sun.star.beans.XPropertySet = _
' ' NOO._objProperty(xds,
"Settings")
'
'NOO.nfPropertyDisplay(ps)
' Dim xcon As
unoidl.com.sun.star.sdbc.XConnection = _
'
xds.getConnection("", "")
'
Else
'
MessageBox.Show(strError, "Error DataSource")
'
End If
'Next
'''''Direct Connection1 this method is not fit to VisualStudio
'Dim strError As String =
fLoadDB(strDBFileName, g_xodd)
'If strError <> "" Then
'
Return strError
'End If
'Dim xds As
unoidl.com.sun.star.sdbc.XDataSource = g_xodd.DataSource
'g_con = xds.getConnection(strUser,
strPassword)
'''''Direct Connection2
Dim xmsf As
unoidl.com.sun.star.lang.XMultiServiceFactory = _
g_xcc.getServiceManager
Dim dc As
Object = xmsf.createInstance("com.sun.star.sdb.DatabaseContext")
Dim xna As
unoidl.com.sun.star.container.XNameAccess = dc
Dim any As
uno.Any = xna.getByName(NIO.nfFilePathToFileURL(strDBFileName))
Dim xds As
unoidl.com.sun.star.sdbc.XDataSource = any.Value
g_con = xds.getConnection(strUser, strPassword)
g_xs = g_con.createStatement
'g_xodd = Nothing
'fLoadDB(strDBFileName, g_xodd)
g_strDBFileName = strDBFileName
Return ""
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
'Private
Function fGetDataSource _
' (ByVal strDataSourceName As String
_
' , ByVal xna As unoidl.com.sun.star.container.XNameAccess
_
' , ByRef xds As
unoidl.com.sun.star.sdbc.XDataSource _
' ) As String
' Try
' Dim any As
uno.Any = xna.getByName(strDataSourceName)
' xds = any.Value
' Return
""
' Catch ex As Exception
' Return
NOO.nfURLToFile(g_xcc, ex.Message)
'
'NSS.nfDW(NOO.nfURLToFile(g_xcc, ex.Message), "")
'
'NError.nfShow(ex, Err.Number)
' 'Return Nothing
' End Try
'End
Function
''' <summary>
'''
DBCreate
''' </summary>
''' <param name="strDBFileName">DBFileName</param>
''' <param name="blnOverWrite">true=OverWrite</param>
Public
Function nfDBCreate _
(ByVal strDBFileName As
String _
, Optional ByVal
blnOverWrite As Boolean
= True _
) As String
Try
Dim strError As
String = NIO.nfChekPath(strDBFileName, True)
If strError <> "" Then
Return strError
End If
If blnOverWrite = False AndAlso _
NIO.nfFileExists(strDBFileName) = "" Then
Return "*already exists "
& strDBFileName
End If
Dim xcl As
unoidl.com.sun.star.frame.XComponentLoader = g_xdesktop
Dim npv As
New nNOOPropertyValue
npv.nfAdd("Hidden", True)
'when start from VS debug mode, execution stop
here
g_xodd = _
xcl.loadComponentFromURL("private:factory/sdatabase" _
, "_blank" _
, unoidl.com.sun.star.frame.FrameSearchFlag.CREATE _
, npv._PropertyValues _
)
Dim xds As
unoidl.com.sun.star.sdbc.XDataSource = g_xodd.DataSource
'This defines use of Embedded HSQL Database
NOO._objProperty(xds, "URL") =
"sdbc:embedded:hsqldb"
Dim xstb As
unoidl.com.sun.star.frame.XStorable = g_xodd
npv = New nNOOPropertyValue
xstb.storeAsURL(NIO.nfFilePathToFileURL(strDBFileName),
npv._PropertyValues)
g_strDBFileName = strDBFileName
'Dim xns As
unoidl.com.sun.star.uno.XNamingService = _
'
g_xmsf.createInstance("com.sun.star.sdb.DatabaseContext")
''ŻźÍreplacełęé
'xns.registerObject(strDBName, xds)
'Dim xcla As
unoidl.com.sun.star.util.XCloseable = xodd
'xcla.close(True)
'Dim xc As unoidl.com.sun.star.lang.XComponent
= xodd
'xc.dispose()
Return ""
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
DBContext
''' </summary>
''' <param name="strDBName">DBName</param>
''' <param name="strDBFileName">DBFileName</param>
Public
Function nfAddDBContext _
(ByVal strDBName As String _
, ByVal strDBFileName As
String _
) As String
Try
Dim xodd As
unoidl.com.sun.star.sdb.XOfficeDatabaseDocument = Nothing
Dim strError As
String = fLoadDB(strDBFileName, xodd)
If strError <> "" Then
Return strError
End If
Dim xds As
unoidl.com.sun.star.sdbc.XDataSource = xodd.DataSource
Dim xns As
unoidl.com.sun.star.uno.XNamingService = _
g_xmsf.createInstance("com.sun.star.sdb.DatabaseContext")
'same name is replaced
xns.registerObject(strDBName, xds)
Dim xcla As
unoidl.com.sun.star.util.XCloseable = xodd
xcla.close(True)
'Dim xc As unoidl.com.sun.star.lang.XComponent
= xodd
'xc.dispose()
Return ""
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
Private
Function fLoadDB _
(ByVal strDBFileName As
String _
, ByRef xodd As
unoidl.com.sun.star.sdb.XOfficeDatabaseDocument _
) As String
Try
xodd = Nothing
If NIO.nfFileExists(strDBFileName)
<> "" Then
Return "*DBFile not exist "
& strDBFileName
End If
Dim npv As
New nNOOPropertyValue
npv.nfAdd("Hidden", True)
Dim xcl As
unoidl.com.sun.star.frame.XComponentLoader = g_xdesktop
xodd = xcl.loadComponentFromURL(NIO.nfFilePathToFileURL(strDBFileName) _
, "_blank" _
, 0 _
, npv._PropertyValues _
)
Return ""
Catch ex As Exception
'NError.nfShow(ex,
Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
remove DBContext </summary>
''' <param name="strDBName">DBName</param>
Public
Function nfRemoveDBContext _
(ByVal strDBName As String _
) As String
Try
Dim xna As
unoidl.com.sun.star.container.XNameAccess = _
g_xmsf.createInstance("com.sun.star.sdb.DatabaseContext")
'Dim strs() As String = xna.getElementNames
If xna.hasByName(strDBName) = False Then
Return "*invalid DBName "
& strDBName
End If
Dim xns As
unoidl.com.sun.star.uno.XNamingService = xna
xns.revokeObject(strDBName)
Return ""
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
DBClose
''' </summary>
Public
Function nfDBClose _
( _
) As String
Try
If g_con IsNot
Nothing Then
g_con.close()
g_con
= Nothing
If g_xodd IsNot
Nothing Then
'Dim xcla As
unoidl.com.sun.star.util.XCloseable = g_xodd
'xcla.close(True)
Dim xc As
unoidl.com.sun.star.lang.XComponent = g_xodd
xc.dispose()
g_xodd = Nothing
End If
g_xcc = Nothing
g_xmsf = Nothing
g_xdesktop = Nothing
End If
Return ""
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Update,Insert
''' </summary>
''' <param name="strSQL">
'''
Insert into "xtbl" ("aaa","bbb") values
("1","2")
'''
Update "xtbl" set "aaa"="1" where
"aaa"="2"
''' </param>
Public
Function nfUpdate _
(ByVal strSQL As String _
) As Integer
Try
Dim intCount As
Integer = g_xs.executeUpdate(strSQL)
Return intCount
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Execute
''' </summary>
''' <param name="strSQL">
'''
create table "xtbl" .....
''' </param>
Public
Function nfExecute _
(ByVal strSQL As String _
) As Boolean
Try
Dim bln As
Boolean = g_xs.execute(strSQL)
Return bln
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
Public
Function nfDBRefreshTables _
( _
) As Boolean
Try
If g_xodd Is
Nothing Then
Dim strError As
String = fLoadDB(g_strDBFileName, g_xodd)
If strError <> "" Then
Return strError
End If
End If
Dim xmdl As
unoidl.com.sun.star.frame.XModel = g_xodd
Dim xfrm As
unoidl.com.sun.star.frame.XFrame = _
xmdl.getCurrentController.getFrame
Dim pvs1() As
unoidl.com.sun.star.beans.PropertyValue = Nothing
'If pvs Is Nothing Then
'
pvs1 = New unoidl.com.sun.star.beans.PropertyValue() {}
'Else
'
pvs1 = pvs
'End If
g_xdh.executeDispatch(xfrm _
, ".uno:DBRefreshTables" _
, "" _
, 0 _
, pvs1 _
)
'Dim xcla As
unoidl.com.sun.star.util.XCloseable = xodd
'xcla.close(True)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
Private
Function fDisplayConfig _
(ByVal pLevel As Integer _
, ByVal strConfig As String _
, ByVal XConfigProvder As
unoidl.com.sun.star.lang.XMultiServiceFactory _
, ByVal stb As
StringBuilder _
) As Boolean
Try
Dim args(0) As
uno.Any
args(0) = New uno.Any(GetType(unoidl.com.sun.star.beans.PropertyValue) _
, New unoidl.com.sun.star.beans.PropertyValue
_
("nodepath" _
, 0 _
, New uno.Any(strConfig) _
, unoidl.com.sun.star.beans.PropertyState.DEFAULT_VALUE _
)
_
)
NSS.nfDW(strConfig, "")
Dim xna As
unoidl.com.sun.star.container.XNameAccess = _
XConfigProvder.createInstanceWithArguments _
("com.sun.star.configuration.ConfigurationAccess", args)
Dim strs() As
String = xna.getElementNames
Array.Sort(strs)
Dim blnIsSinglePath As Boolean = False
For p1 As
Integer = 0 To
strs.Length - 1
stb.Append(" ".PadRight(pLevel + 1) & strs(p1) &
vbTab)
Dim any As
uno.Any = xna.getByName(strs(p1))
If any.Value Is
Nothing Then
stb.Append("Nothing")
ElseIf any.Value.GetType Is GetType(Object) Then
stb.Append(any.Value.GetType.ToString)
If blnIsSinglePath = False AndAlso
any.Value IsNot Nothing
Then
stb.Append(vbLf)
fDisplayConfig(pLevel + 1 _
, strConfig & "/" & strs(p1) _
,
XConfigProvder _
, stb _
)
End If
Else
stb.Append(any.Value.GetType.ToString & vbTab &
any.Value.ToString)
If strs(p1) = "IsSinglePath" Then
blnIsSinglePath = any.Value
End If
End If
stb.Append(vbLf)
Next
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
GetDBInfo
''' </summary>
Public
Function nfGetDBInfo _
( _
) As nNDB.g_ctypDBInfo
Try
If g_con Is
Nothing Then
NError.nfRaise("", "not connecct error")
End If
Dim clsDBInfo As
New nNDB.g_ctypDBInfo
Dim xts As
unoidl.com.sun.star.sdbcx.XTablesSupplier = g_con
Dim xna As
unoidl.com.sun.star.container.XNameAccess = xts.getTables
Dim strTableIDs() As String = xna.getElementNames
For p1 As
Integer = 0 To
strTableIDs.Length - 1
Dim clsTableHeader As New
nNDB.g_ctypDBTableHeader
clsTableHeader.strID = strTableIDs(p1)
Dim objTable As
Object = xna.getByName(strTableIDs(p1)).Value
clsTableHeader.strSchema = NOO._objProperty(objTable,
"SchemaName")
clsTableHeader.strType = NOO._objProperty(objTable, "Type")
'NOO.nfPropertyDisplay(objTable)
clsDBInfo.lstTableHeader.Add(clsTableHeader)
Next
Return clsDBInfo
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>GetTableInfo
''' </summary>
''' <param name="strTableID">Table ID</param>
Public
Function nfGetTableInfo _
(ByVal strTableID As String _
) As nNDB.g_ctypDBTableInfo
Try
If g_con Is
Nothing Then
NError.nfRaise("not yet Connect", "Not ConnectDB
error")
End If
Dim xts As
unoidl.com.sun.star.sdbcx.XTablesSupplier = g_con
Dim xna As
unoidl.com.sun.star.container.XNameAccess = xts.getTables
Dim strTableIDs() As String =
xna.getElementNames
If NArray.nfSearch(strTableIDs,
strTableID) = -1 Then
NError.nfRaise(strTableID,
"strTableID error")
End If
Dim clsDBTableInfo As New
nNDB.g_ctypDBTableInfo
clsDBTableInfo.strTableID = strTableID
''Column
Dim xcs As
unoidl.com.sun.star.sdbcx.XColumnsSupplier = _
xna.getByName(strTableID).Value
Dim xiaColumn As
unoidl.com.sun.star.container.XIndexAccess = xcs.getColumns
For p1 As
Integer = 0 To
xiaColumn.getCount - 1
Dim clsDBField As
New nNDB.g_ctypDBField
Dim objColumn As Object = xiaColumn.getByIndex(p1).Value
'NOO.nfPropertyDisplay(objColumn)
clsDBField.strID = NOO._objProperty(objColumn, "Name")
clsDBField.strType = NOO._objProperty(objColumn, "TypeName")
If
clsDBField.strType = "VARCHAR" OrElse
_
clsDBField.strType = "LONGVARCHAR" OrElse
_
clsDBField.strType = "CHAR" OrElse
_
clsDBField.strType = "VARBINARY" OrElse
_
clsDBField.strType = "BINARY" Then
clsDBField.chrNFSType = "x"c
ElseIf clsDBField.strType =
"TYNYINT" OrElse _
clsDBField.strType = "SMALLINT" OrElse
_
clsDBField.strType = "INTEGER" OrElse
_
clsDBField.strType = "BIGINT" OrElse
_
clsDBField.strType = "DECIMAL" OrElse
_
clsDBField.strType = "NUMERIC" OrElse
_
clsDBField.strType = "FLOAT" OrElse
_
clsDBField.strType = "DOUBLE" OrElse
_
clsDBField.strType = "REAL " Then
clsDBField.chrNFSType = "s"c
ElseIf clsDBField.strType =
"BOOLEAN" OrElse _
clsDBField.strType = "DATE" OrElse
_
clsDBField.strType = "TIME" OrElse
_
clsDBField.strType = "DATESTAMP" Then
clsDBField.chrNFSType = "u"c
End If
clsDBField.i64S
=
NOO._objProperty(objColumn, "Precision")
clsDBField.intŹ
=
NOO._objProperty(objColumn, "Scale")
clsDBField.blnNull = If(NOO._objProperty(objColumn,
"IsNullable") = 1, True, False)
clsDBField.strComment = NOO._objProperty(objColumn,
"HelpText")
'Get NSS Num
NDBMS.nfDBCommentćčNSSp
o(clsDBField.strComment, clsDBField)
clsDBTableInfo.lstDBField.Add(clsDBField)
Next
'Get Index
Dim xis As
unoidl.com.sun.star.sdbcx.XIndexesSupplier = _
xna.getByName(strTableID).Value
Dim xiaIndex As
unoidl.com.sun.star.container.XIndexAccess = xis.getIndexes
For p1 As
Integer = 0 To
xiaIndex.getCount - 1
Dim clsKey As
New nNDB.g_ctypDBKey
Dim objIndex As
Object = xiaIndex.getByIndex(p1).Value
'NOO.nfPropertyDisplay(objIndex)
clsKey.strKeyID = NOO._objProperty(objIndex, "Name")
Dim xcsIndex As
unoidl.com.sun.star.sdbcx.XColumnsSupplier = objIndex
Dim xiaIndexColumn As unoidl.com.sun.star.container.XIndexAccess = _
xcsIndex.getColumns
ReDim Preserve
clsKey.strFieldIDs(xiaIndexColumn.getCount - 1)
ReDim Preserve
clsKey.blnDecendings(xiaIndexColumn.getCount - 1)
ReDim Preserve
clsKey.blnDuplicates(xiaIndexColumn.getCount - 1)
ReDim Preserve
clsKey.blnIgnoreNulls(xiaIndexColumn.getCount - 1)
If NOO._objProperty(objIndex,
"IsUnique") = True Then
clsKey.blnDuplicates(0) = False
Else
clsKey.blnDuplicates(0) = True
End If
For p2 As
Integer = 0 To
xiaIndexColumn.getCount - 1
Dim objIndexColumn As Object = xiaIndexColumn.getByIndex(p2).Value
'NOO.nfPropertyDisplay(objIndexColumn)
clsKey.strFieldIDs(p2) = NOO._objProperty(objIndexColumn,
"Name")
clsKey.blnDecendings(p2) = Not
NOO._objProperty(objIndexColumn, "IsAscending")
If p2 <> 0 Then
clsKey.blnDuplicates(0) = clsKey.blnDuplicates(p2)
End If
Next
clsDBTableInfo.lstDBKey.Add(clsKey)
Next
'''''set PrimaryKey
Dim xks As
unoidl.com.sun.star.sdbcx.XKeysSupplier = _
xna.getByName(strTableID).Value
Dim xiaKey As
unoidl.com.sun.star.container.XIndexAccess = xks.getKeys
ReDim
clsDBTableInfo.pPrimaryKeyIndexs(xiaKey.getCount - 1)
For p1 As
Integer = 0 To
xiaKey.getCount - 1
Dim objKey As
Object = xiaKey.getByIndex(p1).Value
'NOO.nfPropertyDisplay(objKey)
'search clsTableField.lstKey
Dim xcsKey As
unoidl.com.sun.star.sdbcx.XColumnsSupplier = objKey
Dim xiaKeyColumn As unoidl.com.sun.star.container.XIndexAccess = _
xcsKey.getColumns
For p2 As
Integer = 0 To
clsDBTableInfo.lstDBKey.Count - 1
If
clsDBTableInfo.lstDBKey(p2).strFieldIDs.Length = xiaKeyColumn.getCount Then
Dim bln As
Boolean = True
For p3 As
Integer = 0 To
xiaKeyColumn.getCount - 1
Dim objKeyColumn As Object =
xiaKeyColumn.getByIndex(p3).Value
'NOO.nfPropertyDisplay(objKeyColumn)
If
clsDBTableInfo.lstDBKey(p2).strFieldIDs(p3) <> _
NOO._objProperty(objKeyColumn, "Name") Then
bln = False
Exit For
End If
Next
If bln = True
Then
clsDBTableInfo.pPrimaryKeyIndexs(p1) = p2
clsDBTableInfo.lstDBKey(p2).strKeyID = NOO._objProperty(objKey,
"Name")
End If
End If
Next
Next
Return clsDBTableInfo
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
CommentSet
''' </summary>
''' <param name="strTableID">TableID</param>
''' <param name="strColumnID">ColumnID</param>
''' <param name="strComment">Comment</param>
Public
Function nfCommentSet _
(ByVal strTableID As String _
, ByVal strColumnID As String _
, ByVal strComment As String _
) As Boolean
Try
If g_con Is
Nothing Then
NError.nfRaise("not yet Connect", "Not ConnectDB
error")
End If
Dim xts As
unoidl.com.sun.star.sdbcx.XTablesSupplier = g_con
Dim xna As
unoidl.com.sun.star.container.XNameAccess = xts.getTables
Dim strTableIDs() As String =
xna.getElementNames
If NArray.nfSearch(strTableIDs,
strTableID) = -1 Then
NError.nfRaise(strTableID, "strTableID error")
End
If
Dim xcs As
unoidl.com.sun.star.sdbcx.XColumnsSupplier = _
xna.getByName(strTableID).Value
Dim xnaColumn As
unoidl.com.sun.star.container.XNameAccess = xcs.getColumns
'objColumn is Nothing but realy exist
Dim objColumn As Object = xnaColumn.getByName(strColumnID).Value
NOO._objProperty(objColumn, "HelpText") = strComment
NOO._objProperty(objColumn, "Align") = NSS.nfCInt(0)
NOO._objProperty(objColumn, "FormatKey") = NSS.nfCInt(0)
'Dim xu As unoidl.com.sun.star.util.XUpdatable
= xnaColumn
'xu.update()
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Version
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_strVersion() As String
Get
Return g_strVersion
End Get
End
Property
''' <summary>
'''
DataBaseContexts
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_strDataBaseContexts() As String()
Get
Dim xna As
unoidl.com.sun.star.container.XNameAccess = _
g_xmsf.createInstance("com.sun.star.sdb.DatabaseContext")
Return xna.getElementNames
End
Get
End
Property
End Class
5-2.nNBaseRowSet
Imports System.ComponentModel
Imports System.Drawing
Imports System.Text
Imports System.Windows.Forms
''' <summary>
''' Open Office Base
''' </summary>
Public Class nNBaseRowSet
Private
g_nbase As nNBase
Private
g_xrs As unoidl.com.sun.star.sdbc.XRowSet
Public
Class g_ctypColumnInfo
Public strCatalogName As
String
Public strServiceName As
String
Public strSchemaName As
String
Public strName As String
Public strLabel As String
Public intType As Integer
Public strTypeNmae As
String
Public intPrecision As
Integer
Public intScale As Integer
End
Class
Public
g_clsColumnInfos() As g_ctypColumnInfo
''' <summary>
''' New
''' </summary>
''' <param name="nbase">nNBase</param>
Public
Sub New _
(ByVal nbase As nNBase
_
)
Try
g_nbase = nbase
If g_nbase.g_con Is Nothing Then
NError.nfRaise("not yet Connect", "Not ConnectDB
error")
End If
g_xrs =
nbase.g_xmsf.createInstance("com.sun.star.sdbc.RowSet")
NOO._objProperty(g_xrs, "ActiveConnection") = nbase.g_con
Catch ex As Exception
NError.nfShow(ex, Err.Number)
End Try
End
Sub
''' <summary>
''' Open
''' </summary>
''' <param name="strSQL">SQL ex)select * from xxxx</param>
''' <param name="ct">unoidl.com.sun.star.sdb.CommandType</param>
Public
Function nfOpen _
(ByVal strSQL As String _
, Optional ByVal ct As Integer = _
unoidl.com.sun.star.sdb.CommandType.COMMAND _
) As Integer
Try
NOO._objProperty(g_xrs, "CommandType") = ct
NOO._objProperty(g_xrs, "Command") = strSQL
g_xrs.execute()
'NOO.nfPropertyDisplay(g_xrs)
nfGetRSColumnInfo()
Dim intRowCount As
Integer = NOO._objProperty(g_xrs,
"RowCount")
If intRowCount > 0 Then
nfRSMoveNext()
End If
Return intRowCount
''''''way of XResultSet
'Dim xs As unoidl.com.sun.star.sdbc.XStatement =
g_con.createStatement
'NOO._objProperty(xs,
"ResultSetType") = _
'
unoidl.com.sun.star.sdbc.ResultSetType.SCROLL_SENSITIVE
''unoidl.com.sun.star.sdbc.ResultSetType.FORWARD_ONLY()
''unoidl.com.sun.star.sdbc.ResultSetType.SCROLL_INSENSITIVE()
'g_xrs = xs.executeQuery(strSQL)
'If g_xrs Is Nothing Then
'
Return 0
'End If
'Dim intNow As Integer = g_xrs.getRow
'g_xrs.last()
'Dim intCount As Integer = g_xrs.getRow
'g_xrs.absolute(intNow)
'Dim intRowCount As Integer = 0
'Do While g_xrs.next = True
'
intRowCount = g_xrs.getRow
'Loop
'g_xrs = xs.executeQuery(strSQL)
'Return intCount
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
update current RowSet
''' </summary>
''' <param name="objIndex">Index(1-) or ItemName</param>
''' <param name="objData">Data</param>
Public
Function nfRSUpdate _
(ByVal objIndex As Object _
, ByVal objData As Object _
) As Boolean
Try
NOO._objProperty(g_xrs, "ResultSetConcurrency") = _
unoidl.com.sun.star.sdbc.ResultSetConcurrency.UPDATABLE
Dim intIndex As
Integer = 0
If objIndex.GetType Is GetType(String) Then
Dim strName As
String = objIndex
For p1 As
Integer = 0 To
g_clsColumnInfos.Length - 1
If
NStr.nfCompare(g_clsColumnInfos(p1).strName, strName) = 0 Then
intIndex = p1 + 1
Exit For
End If
Next
If intIndex = 0 Then
NError.nfRaise(objIndex, "objIndex error")
End If
Else
intIndex = objIndex
If intIndex < 1 OrElse _
intIndex > g_clsColumnInfos.Length Then
NError.nfRaise(objIndex, "objIndex error")
End If
End If
Dim xru As
unoidl.com.sun.star.sdbc.XRowUpdate = g_xrs
xru.updateString(intIndex, objData)
Dim xrsu As
unoidl.com.sun.star.sdbc.XResultSetUpdate = g_xrs
xrsu.updateRow()
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
insert RowSet
''' </summary>
''' <param name="objDatas">Data</param>
Public
Function nfRSInsert _
(ByVal
objDatas() As Object
_
) As Boolean
Try
NOO._objProperty(g_xrs, "ResultSetConcurrency") = _
unoidl.com.sun.star.sdbc.ResultSetConcurrency.UPDATABLE
Dim xrsu As
unoidl.com.sun.star.sdbc.XResultSetUpdate = g_xrs
xrsu.moveToInsertRow()
Dim xru As
unoidl.com.sun.star.sdbc.XRowUpdate = g_xrs
For p1 As
Integer = 0 To
g_clsColumnInfos.Length - 1
If p1 > objDatas.Length - 1 Then
Exit For
End If
xru.updateString(p1
+ 1, objDatas(p1))
Next
xrsu.insertRow()
xrsu.moveToCurrentRow()
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
delete current RowSet
''' </summary>
Public
Function nfRSDelete _
( _
) As Boolean
Try
NOO._objProperty(g_xrs, "ResultSetConcurrency") = _
unoidl.com.sun.star.sdbc.ResultSetConcurrency.UPDATABLE
Dim xrsu As
unoidl.com.sun.star.sdbc.XResultSetUpdate = g_xrs
xrsu.deleteRow()
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' get
RowSet Column Information
''' </summary>
Public
Function nfGetRSColumnInfo _
( _
) As Boolean
Try
Dim xrss As
unoidl.com.sun.star.sdbc.XResultSetMetaDataSupplier = g_xrs
Dim xrsmd As
unoidl.com.sun.star.sdbc.XResultSetMetaData = xrss.getMetaData
ReDim
g_clsColumnInfos(xrsmd.getColumnCount - 1)
For p1 As
Integer = 0 To
xrsmd.getColumnCount - 1
Dim clsColumnInfo As New
g_ctypColumnInfo
With clsColumnInfo
.strCatalogName = xrsmd.getCatalogName(p1 + 1)
.strSchemaName = xrsmd.getSchemaName(p1 + 1)
.strServiceName = xrsmd.getColumnServiceName(p1 + 1)
.strName = xrsmd.getColumnName(p1 + 1)
.strLabel
= xrsmd.getColumnLabel(p1 + 1)
.intType = xrsmd.getColumnType(p1 + 1)
.strTypeNmae = xrsmd.getColumnTypeName(p1 + 1)
.intPrecision = xrsmd.getPrecision(p1 + 1)
.intScale = xrsmd.getScale(p1 + 1)
End With
g_clsColumnInfos(p1) = clsColumnInfo
Next
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' get
RowSet Datas
''' </summary>
Public
Function nfGetRSDatas _
( _
) As String()
Try
If g_xrs Is
Nothing Then
NError.nfRaise("", "XRowSet error")
End If
Dim xcs As
unoidl.com.sun.star.sdbcx.XColumnsSupplier = g_xrs
Dim
strs(xcs.getColumns.getElementNames.Length - 1) As
String
Dim xrow As
unoidl.com.sun.star.sdbc.XRow = g_xrs
For int1 As
Integer = 1 To
strs.Length
strs(int1 - 1) = xrow.getString(int1)
Next
Return strs
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
Public
Function nfRSRefresh _
( _
) As Boolean
Try
If g_xrs Is
Nothing Then
NError.nfRaise("", "XRowSet error")
End If
g_xrs.refreshRow()
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
RowSet MoveNext
''' </summary>
Public
Function nfRSMoveNext _
( _
) As Boolean
Try
If g_xrs Is
Nothing Then
NError.nfRaise("", "XRowSet error")
End If
Return g_xrs.next
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
RowSet MovePrevious
''' </summary>
Public
Function nfRSMovePrevious _
( _
) As Boolean
Try
If g_xrs Is
Nothing Then
NError.nfRaise("", "XRowSet error")
End If
Return g_xrs.previous
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
RowSet MoveLast
''' </summary>
Public
Function nfRSMoveLast _
( _
) As Boolean
Try
If g_xrs Is
Nothing Then
NError.nfRaise("", "XRowSet error")
End If
g_xrs.last()
Return
True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
RowSet MoveAfterLast
''' </summary>
Public
Function nfRSMoveAfterLast _
( _
) As Boolean
Try
If g_xrs Is
Nothing Then
NError.nfRaise("", "XRowSet error")
End If
g_xrs.afterLast()
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
RowSet MoveFirst
''' </summary>
Public
Function nfRSMoveFirst _
( _
) As Boolean
Try
If g_xrs Is
Nothing Then
NError.nfRaise("", "XRowSet error")
End
If
g_xrs.first()
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
RowSet MoveBeforeFirst
''' </summary>
Public
Function nfRSMoveBeforeFirst _
( _
) As Boolean
Try
If g_xrs Is
Nothing Then
NError.nfRaise("", "XRowSet error")
End If
g_xrs.beforeFirst()
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
RowSet MoveAbsolute
''' </summary>
Public
Function nfRSMoveAbsolute _
(ByVal intRoeNO As Integer _
) As Boolean
Try
If g_xrs Is
Nothing Then
NError.nfRaise("", "XRowSet error")
End If
Return g_xrs.absolute(intRoeNO)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Close
''' </summary>
Public
Function nfClose _
( _
) As Boolean
Try
Dim xc As
unoidl.com.sun.star.lang.XComponent = g_xrs
xc.dispose()
g_xrs = Nothing
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' BOF
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_blnBOF _
( _
) As Boolean
Get
Return g_xrs.isBeforeFirst
End Get
End
Property
''' <summary>
'''
First
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_blnFirst _
( _
) As Boolean
Get
Return g_xrs.isFirst
End Get
End
Property
''' <summary>
''' EOF
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_blnEOF _
( _
) As Boolean
Get
Return g_xrs.isAfterLast
End Get
End
Property
''' <summary>
''' Last
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_blnLast _
( _
) As Boolean
Get
Return g_xrs.isLast
End Get
End
Property
''' <summary>
'''
Deleted
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_blnDeleted _
( _
) As Boolean
Get
Return g_xrs.rowDeleted
End Get
End
Property
''' <summary>
'''
Inserted
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_blnInserted _
( _
) As Boolean
Get
Return g_xrs.rowInserted
End Get
End
Property
''' <summary>
'''
Updated
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_blnUpdated _
( _
) As Boolean
Get
Return g_xrs.rowUpdated
End Get
End
Property
''' <summary>
'''
RowNO
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_intRowNO _
( _
) As Integer
Get
Return g_xrs.getRow
End Get
End
Property
''' <summary>
'''
Statement
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_objStatement _
( _
) As Integer
Get
Return g_xrs.getStatement
End Get
End
Property
End Class
8-1.nNOOGraphic
Imports System.ComponentModel
Imports System.Drawing
Imports System.Text
Public Class nNOOGraphic
Private
g_xgr As unoidl.com.sun.star.graphic.XGraphic
Public
Sub New _
(ByVal objComponent As
Object _
, ByVal strFileName As String _
)
Try
If NIO.nfFileExists(strFileName)
<> "" Then
NError.nfRaise(strFileName, "strFileName error")
End If
Dim xcc As
unoidl.com.sun.star.uno.XComponentContext = objComponent.g_xcc
Dim xmcf As
unoidl.com.sun.star.lang.XMultiComponentFactory = _
xcc.getServiceManager
Dim xgp As
unoidl.com.sun.star.graphic.XGraphicProvider = _
xmcf.createInstanceWithContext("com.sun.star.graphic.GraphicProvider"
_
, xcc _
)
'Dim str As String =
NIO.nfFilePathToFileURL(strFileName)
Dim pv As
New nNOOPropertyValue("URL",
NIO.nfFilePathToFileURL(strFileName))
g_xgr = xgp.queryGraphic(pv._PropertyValues)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
End Try
End
Sub
Public
Sub New _
(ByVal xgr As
unoidl.com.sun.star.graphic.XGraphic _
)
Try
g_xgr = xgr
Catch ex As Exception
NError.nfShow(ex, Err.Number)
End Try
End
Sub
''' <summary>
'''
Alpha
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_blnAlpha _
( _
) As Boolean
Get
Return NOO._objProperty(g_xgr,
"Alpha")
End Get
End
Property
''' <summary>
'''
Animated
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_blnAnimated _
( _
) As Boolean
Get
Return NOO._objProperty(g_xgr, "Animated")
End Get
End
Property
''' <summary>
'''
BitsPerPixel CTPAHHO Boolean
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_shtBitsPerPixel _
( _
) As Short
Get
Return NOO._objProperty(g_xgr,
"BitsPerPixel")
End Get
End
Property
''' <summary>
'''
GraphicType
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_bytGraphicType _
( _
) As Byte
Get
Return
NOO._objProperty(g_xgr, "GraphicType")
End Get
End
Property
''' <summary>
'''
MimeTypeType
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_strMimeTypeType _
( _
) As String
Get
Return NOO._objProperty(g_xgr,
"MimeType")
End Get
End
Property
''' <summary>
'''
Size100thMM
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_siz100thMM _
( _
) As Size
Get
Dim siz As
unoidl.com.sun.star.awt.Size = _
NOO._objProperty(g_xgr, "Size100thMM")
Return NOO.nfToDrawingSize(siz)
End Get
End
Property
''' <summary>
'''
aet.Size100thMM
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_awtsiz100thMM _
( _
) As unoidl.com.sun.star.awt.Size
Get
Return NOO._objProperty(g_xgr,
"Size100thMM")
End Get
End
Property
''' <summary>
'''
SizePixel
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_sizPixel _
( _
) As Size
Get
Dim siz As
unoidl.com.sun.star.awt.Size = _
NOO._objProperty(g_xgr, "SizePixel")
Return NOO.nfToDrawingSize(siz)
End Get
End
Property
''' <summary>
'''
Transparent
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_blnTransparent _
( _
) As Boolean
Get
Return NOO._objProperty(g_xgr,
"Transparent")
End Get
End
Property
''' <summary>
'''
Graphic
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_Graphic _
( _
) As unoidl.com.sun.star.graphic.XGraphic
Get
Return g_xgr
End Get
End
Property
End Class
8-2.nNOOPrinter
Imports System.ComponentModel
Public Class nNOOPrinter
Private
g_doc As Object
Public
Sub New _
(ByVal doc As Object _
)
Try
g_doc = doc
Catch ex As Exception
NError.nfShow(ex, Err.Number)
End Try
End
Sub
''' <summary>
'''
Print
''' </summary>
''' <param name="strPrinterName">PrinterName</param>
''' <param name="shtNumCopies">NumCopies</param>
Public
Function nfPrint _
(ByVal strPrinterName As
String _
, ByVal shtNumCopies As
Short _
) As Boolean
Try
Dim xpb As
unoidl.com.sun.star.view.XPrintable = g_doc
If strPrinterName <> "" Then
_strPrinterName() = strPrinterName
End If
Dim npv As
New nNOOPropertyValue()
npv = New nNOOPropertyValue()
If shtNumCopies > 1 Then
npv.nfAdd("CopyCount", shtNumCopies)
End If
npv.nfAdd("Wait", True)
xpb.print(npv._PropertyValues)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
PageOrientation
''' </summary>
''' <param name="int">NOO.PageOrientation</param>
Public
Function nfSetPageOrientation _
(ByVal int As NOO.enmPageOrientation
_
) As Boolean
Try
Dim xpb As
unoidl.com.sun.star.view.XPrintable = g_doc
Dim pvs() As
unoidl.com.sun.star.beans.PropertyValue = xpb.getPrinter
Dim bln As
Boolean = False
'For p1 As Integer = 0 To pvs.Length - 1
'
If pvs(p1).Name = "CanSetPaperOrientation" Then
' If
pvs(p1).Value.Value = False Then
'
NError.nfRaise("", "CanSetPaperOrientation=false
error")
' End If
'
End If
'Next
For p1 As
Integer = 0 To
pvs.Length - 1
If pvs(p1).Name =
"PaperOrientation" Then
pvs(p1).Value = New uno.Any(int)
End If
Next
xpb.setPrinter(pvs)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
PrinterName
''' </summary>
<Browsable(False)> _
Public
Property _strPrinterName _
( _
) As String
Get
Dim xpb As
unoidl.com.sun.star.view.XPrintable = g_doc
Dim pvs() As
unoidl.com.sun.star.beans.PropertyValue = xpb.getPrinter
For p1 As
Integer = 0 To
pvs.Length - 1
If pvs(p1).Name = "Name" Then
Return pvs(p1).Value.Value
End If
Next
Return ""
End Get
Set(ByVal Value As String)
Try
Dim xpb As
unoidl.com.sun.star.view.XPrintable = g_doc
Dim pvs() As
unoidl.com.sun.star.beans.PropertyValue = xpb.getPrinter
'Dim str As String = ""
For p1 As
Integer = 0 To
pvs.Length - 1
'str &= pvs(p1).Name & vbTab &
pvs(p1).Value.Value.GetType.Name _
' & vbTab &
pvs(p1).Value.Value.ToString _
' & vbLf
If pvs(p1).Name = "Name" Then
pvs(p1).Value = New uno.Any(Value)
Exit For
End If
Next
xpb.setPrinter(pvs)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
End Class
Imports System.ComponentModel
Public Class nNOOPropertyValue
Private
g_pvs(-1) As unoidl.com.sun.star.beans.PropertyValue
''' <summary>
''' New
''' </summary>
''' <param name="strName">Property name</param>
''' <param name="obj">Object</param>
Public
Sub New _
(Optional ByVal
strName As String
= "" _
, Optional ByVal obj As Object = Nothing _
)
Try
If strName <> "" Then
Dim pv As
New unoidl.com.sun.star.beans.PropertyValue
pv.Name = strName
pv.Value = New uno.Any(obj.GetType, obj)
pv.State = unoidl.com.sun.star.beans.PropertyState.DIRECT_VALUE
ReDim g_pvs(0)
g_pvs(0) = pv
End If
Catch ex As Exception
NError.nfShow(ex, Err.Number)
End Try
End
Sub
''' <param name="strName">Property name</param>
''' <param name="obj">Object</param>
Public
Function nfAdd _
(ByVal strName As String _
, ByVal obj As Object _
) As Boolean
Try
Dim pv As
New unoidl.com.sun.star.beans.PropertyValue
If strName IsNot
Nothing Then
pv.Name = strName
End If
If obj IsNot
Nothing Then
pv.Value = New uno.Any(obj.GetType, obj)
End If
pv.State = unoidl.com.sun.star.beans.PropertyState.DIRECT_VALUE
ReDim Preserve
g_pvs(g_pvs.Length)
g_pvs(g_pvs.Length - 1) = pv
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
PropertyValues
''' </summary>
<Browsable(False)> _
Public
ReadOnly Property
_PropertyValues _
( _
) As unoidl.com.sun.star.beans.PropertyValue()
Get
Return g_pvs
End Get
End
Property
End Class
Imports System.ComponentModel
Public Class nNOOUserDefinedAttibutes
Private
g_xps As unoidl.com.sun.star.beans.XPropertySet
Private
g_xnc As
unoidl.com.sun.star.container.XNameContainer
''' <summary>
''' New
''' </summary>
''' <param name="obj"> Object</param>
Public
Sub New _
(ByVal obj As Object _
)
Try
g_xps = obj
If
g_xps.getPropertySetInfo.hasPropertyByName("UserDefinedAttributes") =
False Then
NError.nfRaise("", "UserDefinedAttributes error")
End If
g_xnc = g_xps.getPropertyValue("UserDefinedAttributes").Value
Catch ex As Exception
NError.nfShow(ex, Err.Number)
End Try
End
Sub
''' <summary>
'''
GetNames
''' </summary>
Public
Function nfGetNames _
( _
) As String()
Try
Return g_xnc.getElementNames
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
remove
''' </summary>
Public
Function nfRemove _
(ByVal strName As String _
) As Boolean
Try
If g_xnc.hasByName(strName) = False Then
Return False
End If
g_xnc.removeByName(strName)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Attribute
''' </summary>
<Browsable(False)> _
Public
Property _objAttribute _
(ByVal strName As String _
) As Object
Get
Dim ad As
unoidl.com.sun.star.xml.AttributeData = g_xnc.getByName(strName).Value
Return ad.Value
End Get
Set(ByVal Value As Object)
If strName.Contains(",") Then
NError.nfRaise(strName, ", is unavailable in strName error")
End If
If g_xnc.hasByName(strName) = True Then
g_xnc.removeByName(strName)
End If
Dim ad As
New unoidl.com.sun.star.xml.AttributeData
ad.Type = strName
ad.Value = Value
g_xnc.insertByName(strName,
New uno.Any(ad.GetType, ad))
g_xps.setPropertyValue("UserDefinedAttributes" _
, New uno.Any(g_xnc.GetType, g_xnc) _
)
End Set
End
Property
End Class
8-5.NOO
Imports System.Drawing
Imports System.ComponentModel
Public Class NOO
''''
<summary>
''''
CalcDocumment Property
''''
</summary>
Enum
enmCalcDocPpt As Integer
''' <summary>System.Boolean def:False</summary>
ApplyFormDesignMode
''' <summary>unoidl.com.sun.star.sheet.XAreaLinks</summary>
AreaLinks
''' <summary>System.Boolean def:False</summary>
AutomaticControlFocus
''' <summary>unoidl.com.sun.star.script.XLibraryContainer</summary>
BasicLibraries
''' <summary>System.String</summary>
BuildId
''' <summary>System.Boolean def:False</summary>
CalcAsShown
''' <summary>unoidl.com.sun.star.lang.Locale</summary>
CharLocale
''' <summary>unoidl.com.sun.star.lang.Locale</summary>
CharLocaleAsian
''' <summary>unoidl.com.sun.star.lang.Locale</summary>
CharLocaleComplex
''' <summary>unoidl.com.sun.star.sheet.XLabelRanges</summary>
ColumnLabelRanges
''' <summary>unoidl.com.sun.star.sheet.XDatabaseRanges</summary>
DatabaseRanges
''' <summary>unoidl.com.sun.star.container.XNameAccess</summary>
DDELinks
''' <summary>System.Int16 def:709</summary>
DefaultTabStop
''' <summary>unoidl.com.sun.star.script.XLibraryContainer</summary>
DialogLibraries
''' <summary>unoidl.com.sun.star.sheet.XExternalDocLinks</summary>
ExternalDocLinks
''' <summary>unoidl.com.sun.star.i18n.XForbiddenCharacters</summary>
ForbiddenCharacters
''' <summary>System.Boolean def:True</summary>
HasDrawPages
''' <summary>System.Boolean def:False</summary>
HasValidSignatures
''' <summary>System.Boolean def:False</summary>
IgnoreCase
''' <summary>System.Boolean def:True</summary>
IsAdjustHeightEnabled
''' <summary>System.Boolean def:False</summary>
IsChangeReadOnlyEnabled
''' <summary>System.Boolean def:True</summary>
IsExecuteLinkEnabled
''' <summary>System.Boolean def:False</summary>
IsIterationEnabled
''' <summary>System.Boolean def:True</summary>
IsLoaded
''' <summary>System.Boolean def:True</summary>
IsUndoEnabled
''' <summary>System.Int32def)100</summary>
IterationCount
''' <summary>System.Double</summary>
IterationEpsilon
''' <summary>System.Boolean def:True</summary>
LookUpLabels
''' <summary>System.Boolean def:True</summary>
MatchWholeCell
''' <summary>unoidl.com.sun.star.sheet.XNamedRanges</summary>
NamedRanges
''' <summary>unoidl.com.sun.star.util.Date</summary>
NullDate
''' <summary>unoidl.com.sun.star.awt.XDevice</summary>
ReferenceDevice
''' <summary>System.Boolean def:True</summary>
RegularExpressions
''' <summary>unoidl.com.sun.star.sheet.XLabelRanges</summary>
RowLabelRanges
''' <summary>System.Stringdef)7</summary>
RuntimeUID
''' <summary>unoidl.com.sun.star.container.XNameAccess</summary>
SheetLinks
'''
<summary>System.Boolean
def:True</summary>
SpellOnline
''' <summary>System.Int16def)2</summary>
StandardDecimals
End
Enum
''''
<summary>
''''
WriterDocummentProperty
''''
</summary>
Enum
enmWrtrDocPpt As Integer
''' <summary>System.Boolean def:False</summary>
ApplyFormDesignMode
''' <summary>System.Boolean def:False</summary>
ApplyWorkaroundForB6375613
''''
<summary>unoidl.com.sun.star.sheet.XAreaLinks</summary>
'AreaLinks
''' <summary>System.Booleandef)False</summary>
AutomaticControlFocus
''' <summary>unoidl.com.sun.star.script.XLibraryContainer</summary>
BasicLibraries
''' <summary>System.String</summary>
BuildId
'''' <summary>System.Booleandef)False</summary>
'CalcAsShown
''' <summary>System.Int32(ReadOnly) def:0</summary>
CharacterCount
''' <summary>System.Int16 def:60</summary>
CharFontCharSet
''' <summary>System.Int16 def:60</summary>
CharFontCharSetAsian
''' <summary>System.Int16 def:60</summary>
CharFontCharSetComplex
''' <summary>System.Int16 def:3</summary>
CharFontFamily
''' <summary>System.Int16 def:6</summary>
CharFontFamilyAsian
''' <summary>System.Int16 def:6</summary>
CharFontFamilyComplex
''' <summary>System.String def:Times New Roman</summary>
CharFontName
''' <summary>System.String def:lr ožŠ</summary>
CharFontNameAsian
''' <summary>System.String def:Mangal</summary>
CharFontNameComplex
''' <summary>System.Int16 def:2</summary>
CharFontPitch
''' <summary>System.Int16 def:2</summary>
CharFontPitchAsian
''' <summary>System.Int16 def:2</summary>
CharFontPitchComplex
''' <summary>System.String</summary>
CharFontStyleName
''' <summary>System.String</summary>
CharFontStyleNameAsian
''' <summary>System.String</summary>
CharFontStyleNameComplex
''' <summary>unoidl.com.sun.star.lang.Locale</summary>
CharLocale
''''
<summary>unoidl.com.sun.star.lang.Locale</summary>
'CharLocaleAsian
'''' <summary>unoidl.com.sun.star.lang.Locale</summary>
'CharLocaleComplex
''''
<summary>unoidl.com.sun.star.sheet.XLabelRanges</summary>
'ColumnLabelRanges
''''
<summary>unoidl.com.sun.star.sheet.XDatabaseRanges</summary>
'DatabaseRanges
''''
<summary>unoidl.com.sun.star.container.XNameAccess</summary>
'DDELinks
'''' <summary>System.Int16 def:709</summary>
'DefaultTabStop
''' <summary>unoidl.com.sun.star.script.XLibraryContainer</summary>
DialogLibraries
''''
<summary>unoidl.com.sun.star.sheet.XExternalDocLinks</summary>
'ExternalDocLinks
''' <summary>unoidl.com.sun.star.i18n.XForbiddenCharacters</summary>
ForbiddenCharacters
'''' <summary>System.Boolean def:True</summary>
'HasDrawPages
''' <summary>System.Boolean def:False</summary>
HasValidSignatures
''' <summary>System.Boolean def:False</summary>
HideFieldTips
'''' <summary>System.Boolean def:False</summary>
'IgnoreCase
''' <summary>System.String</summary>
IndexAutoMarkFileURL
'''' <summary>System.Boolean def:True</summary>
'IsAdjustHeightEnabled
'''' <summary>System.Boolean
def:False</summary>
'IsChangeReadOnlyEnabled
'''' <summary>System.Boolean def:True</summary>
'IsExecuteLinkEnabled
'''' <summary>System.Boolean
def:False</summary>
'IsIterationEnabled
'''' <summary>System.Boolean def:True</summary>
'IsLoaded
'''' <summary>System.Boolean def:True</summary>
'IsUndoEnabled
'''' <summary>System.Int32 def:100</summary>
'IterationCount
'''' <summary>System.Double</summary>
'IterationEpsilon
''' <summary>System.Boolean def:False</summary>
LockUpdates
'''' <summary>System.Boolean def:True</summary>
'LookUpLabels
'''' <summary>System.Boolean def:True</summary>
'MatchWholeCell
'''' <summary>unoidl.com.sun.star.sheet.XNamedRanges</summary>
'NamedRanges
''''
<summary>unoidl.com.sun.star.util.Date</summary>
'NullDate
''' <summary>System.Int32(ReadOnly) def:0</summary>
ParagraphCount
''' <summary>System.Boolean def:False</summary>
RecordChanges
''' <summary>System.Int16 def:2</summary>
RedlineDisplayType
''' <summary>System.Byte[]</summary>
RedlineProtectionKey
'''' <summary>unoidl.com.sun.star.awt.XDevice</summary>
'ReferenceDevice
'''' <summary>System.Boolean def:True</summary>
'RegularExpressions
''''
<summary>unoidl.com.sun.star.sheet.XLabelRanges</summary>
'RowLabelRanges
''' <summary>System.String def:7</summary>
RuntimeUID
''''
<summary>unoidl.com.sun.star.container.XNameAccess</summary>
'SheetLinks
''' <summary>System.Boolean def:True</summary>
ShowChanges
'''' <summary>System.Boolean def:True</summary>
'SpellOnline
'''' <summary>System.Int16 def:2</summary>
'StandardDecimals
''' <summary>System.Int16 def:1930</summary>
TwoDigitYear
''' <summary>System.Int32 def:0</summary>
WordCount
End
Enum
''''
<summary>
''''
Calc Controller Property
''''
</summary>
Enum
enmCalcControllerPpt As Integer
''' <summary>System.Boolean def:True</summary>
ColumnRowHeaders
''' <summary>System.Int32 def:Color [Silver]</summary>
GridColor
''' <summary>System.Boolean def:True</summary>
HasColumnRowHeaders
''' <summary>System.Boolean def:True</summary>
HasHorizontalScrollBar
''' <summary>System.Boolean def:True</summary>
HasSheetTabs
''' <summary>System.Boolean def:True</summary>
HasVerticalScrollBar
''' <summary>System.Boolean def:Nothing</summary>
HideSpellMarks
''' <summary>System.Boolean def:True</summary>
HorizontalScrollBar
''' <summary>System.Boolean def:True</summary>
IsOutlineSymbolsSet
''' <summary>System.Boolean def:False</summary>
IsValueHighlightingEnabled
''' <summary>System.Boolean def:True</summary>
OutlineSymbols
''' <summary>System.Boolean def:True</summary>
SheetTabs
''' <summary>System.Boolean def:True</summary>
ShowAnchor
''' <summary>System.Int16 def:0</summary>
ShowCharts
''' <summary>System.Int16 def:0</summary>
ShowDrawing
''' <summary>System.Boolean def:False</summary>
ShowFormulas
''' <summary>System.Boolean def:False</summary>
ShowGrid
''' <summary>System.Boolean def:False</summary>
ShowHelpLines
''' <summary>System.Boolean def:True</summary>
ShowNotes
''' <summary>System.Int16 def:0</summary>
ShowObjects
''' <summary>System.Boolean def:True</summary>
ShowPageBreaks
''' <summary>System.Boolean def:True</summary>
ShowZeroValues
''' <summary>System.Boolean def:True</summary>
SolidHandles
''' <summary>System.Boolean def:False</summary>
ValueHighlighting
''' <summary>System.Boolean def:True</summary>
VerticalScrollBar
''' <summary>unoidl.com.sun.star.awt.Rectangle</summary>
VisibleArea
''' <summary>System.Int16 def:3</summary>
ZoomType
''' <summary>System.Int16 def:100</summary>
ZoomValue
End
Enum
''' <summary>
'''
Sheet Property
''' </summary>
Enum
enmSheetPpt As Integer
''' <summary>System.String def:$Sheet1.$A$1:$AMJ$65536</summary>
AbsoluteName
''' <summary>System.Boolean def:False</summary>
AsianVerticalMode
''' <summary>System.Boolean def:False</summary>
AutomaticPrintArea
''' <summary>System.Int32 def:Nothhing</summary>
BorderColor
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
BottomBorder
''' <summary>System.Int32 def:Color [White]</summary>
CellBackColor
''' <summary>unoidl.com.sun.star.util.CellProtection</summary>
CellProtection
''' <summary>System.String def:Default</summary>
CellStyle
''' <summary>System.Int32 def:Color [White]</summary>
CharColor
''' <summary>System.Boolean def:False</summary>
CharContoured
''' <summary>System.Boolean def:False</summary>
CharCrossedOut
''' <summary>System.Int16 def:0</summary>
CharEmphasis
''' <summary>System.Int16 def:5</summary>
CharFont
''' <summary>System.Int16 def:60</summary>
CharFontCharSet
''' <summary>System.Int16 def:60</summary>
CharFontCharSetAsian
''' <summary>System.Int16 def:60</summary>
CharFontCharSetComplex
''' <summary>System.Int16 def:5</summary>
CharFontFamily
''' <summary>System.Int16 def:6</summary>
CharFontFamilyAsian
''' <summary>System.Int16 def:6</summary>
CharFontFamilyComplex
''' <summary>System.String def:lr oSVbN</summary>
CharFontName
'System.String lr oSVbN
''' <summary>System.String def:lr oSVbN</summary>
CharFontNameAsian
''' <summary>System.String def:Mangal</summary>
CharFontNameComplex
''' <summary>System.Int16 def:2</summary>
CharFontPitch
''' <summary>System.Int16 def:2</summary>
CharFontPitchAsian
''' <summary>System.Int16 def:2</summary>
CharFontPitchComplex
''' <summary>System.String</summary>
CharFontStyleName
''' <summary>System.String</summary>
CharFontStyleNameAsian
''' <summary>System.String</summary>
CharFontStyleNameComplex
''' <summary>System.Single def:10</summary>
CharHeight
''' <summary>System.Single def:10</summary>
CharHeightAsian
''' <summary>System.Single def:10</summary>
CharHeightComplex
''' <summary>unoidl.com.sun.star.lang.Locale</summary>
CharLocale
''' <summary>unoidl.com.sun.star.lang.Locale</summary>
CharLocaleAsian
''' <summary>unoidl.com.sun.star.lang.Locale</summary>
CharLocaleComplex
''' <summary>System.Int16 def:0</summary>
CharOverline
''' <summary>System.Int32 def:Color [White]</summary>
CharOverlineColor
''' <summary>System.Boolean def:False</summary>
CharOverlineHasColor
''' <summary>unoidl.com.sun.star.awt.FontSlant</summary>
CharPosture
''' <summary>unoidl.com.sun.star.awt.FontSlant</summary>
CharPostureAsian
''' <summary>unoidl.com.sun.star.awt.FontSlant</summary>
CharPostureComplex
''' <summary>System.Int16 def:0</summary>
CharRelief
''' <summary>System.Boolean def:False</summary>
CharShadowed
''' <summary>System.Int16 def:0</summary>
CharStrikeout
''' <summary>System.Boolean def:False</summary>
ChartColumnAsLabel
''' <summary>System.Boolean def:False</summary>
ChartRowAsLabel
''' <summary>System.Int16 def:0</summary>
CharUnderline
''' <summary>System.Int32 def:Color [White]</summary>
CharUnderlineColor
''' <summary>System.Boolean def:False</summary>
CharUnderlineHasColor
''' <summary>System.Single def:100</summary>
CharWeight
''' <summary>System.Single
def:100</summary>
CharWeightAsian
''' <summary>System.Single def:100</summary>
CharWeightComplex
''' <summary>System.Boolean def:False</summary>
CharWordMode
''' <summary>unoidl.com.sun.star.sheet.XSheetConditionalEntries</summary>
ConditionalFormat
''' <summary>unoidl.com.sun.star.sheet.XSheetConditionalEntries</summary>
ConditionalFormatLocal
''' <summary>unoidl.com.sun.star.sheet.XSheetConditionalEntries</summary>
ConditionalFormatXML
''' <summary>System.Boolean def:Nothing</summary>
CopyBack
''' <summary>System.Boolean def:Nothing</summary>
CopyFormulas
''' <summary>System.Boolean def:Nothing</summary>
CopyStyles
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
DiagonalBLTR
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
DiagonalTLBR
''' <summary>unoidl.com.sun.star.table.CellHoriJustify</summary>
HoriJustify
''' <summary>System.Boolean def:Nothing</summary>
IsActive
''' <summary>System.Boolean def:True</summary>
IsCellBackgroundTransparent
''' <summary>System.Boolean def:False</summary>
IsTextWrapped
''' <summary>System.Boolean def:True</summary>
IsVisible
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
LeftBorder
''' <summary>unoidl.com.sun.star.awt.XBitmap</summary>
LinkDisplayBitmap
''' <summary>System.String def:Sheet1</summary>
LinkDisplayName
''' <summary>System.Int32 def:0</summary>
NumberFormat
''' <summary>unoidl.com.sun.star.container.XIndexReplace</summary>
NumberingRules
''' <summary>unoidl.com.sun.star.table.CellOrientation</summary>
Orientation
''' <summary>System.String def:Default</summary>
PageStyle
''' <summary>System.Int16 def:0</summary>
ParaAdjust
''' <summary>System.Int32 def:0</summary>
ParaBottomMargin
''' <summary>System.Int16 def:0</summary>
ParaIndent
''' <summary>System.Boolean def:False</summary>
ParaIsCharacterDistance
''' <summary>System.Boolean def:False</summary>
ParaIsForbiddenRules
''' <summary>System.Boolean def:False</summary>
ParaIsHangingPunctuation
''' <summary>System.Boolean def:False</summary>
ParaIsHyphenation
''' <summary>System.Int16 def:0</summary>
ParaLastLineAdjust
''' <summary>System.Int32 def:35</summary>
ParaLeftMargin
''' <summary>System.Int32 def:35</summary>
ParaRightMargin
''' <summary>System.Int32 def:35</summary>
ParaTopMargin
''' <summary>unoidl.com.sun.star.awt.Point</summary>
Position
''' <summary>System.Boolean def:Nothing</summary>
PrintBorder
''' <summary>System.Boolean def:Nothing</summary>
[Protected]
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
RightBorder
''' <summary>System.Int32 def:0</summary>
RotateAngle
''' <summary>unoidl.com.sun.star.table.CellVertJustify</summary>
RotateReference
''' <summary>unoidl.com.sun.star.table.ShadowFormat</summary>
ShadowFormat
''' <summary>System.Boolean def:Nothing</summary>
ShowBorder
''' <summary>System.Boolean def:False</summary>
ShrinkToFit
''' <summary>unoidl.com.sun.star.awt.Size</summary>
Size
''' <summary>unoidl.com.sun.star.table.TableBorder</summary>
TableBorder
''' <summary>System.Int16 def:0</summary>
TableLayout
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
TopBorder
''' <summary>unoidl.com.sun.star.container.XNameContainer</summary>
UserDefinedAttributes
''' <summary>unoidl.com.sun.star.beans.XPropertySet</summary>
Validation
''' <summary>unoidl.com.sun.star.beans.XPropertySet</summary>
ValidationLocal
''' <summary>unoidl.com.sun.star.beans.XPropertySet</summary>
ValidationXML
''' <summary>unoidl.com.sun.star.table.CellVertJustify</summary>
VertJustify
''' <summary>System.Int16 def:4</summary>
WritingMode
End
Enum
''' <summary>
''' Calc
Range Property
''' </summary>
Enum
enmCalcRangePpt As Integer
''' <summary>System.String def:$Sheet1.$A$1</summary>
AbsoluteName
''' <summary>System.Boolean def:False</summary>
AsianVerticalMode
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
BottomBorder
''' <summary>System.Int32 def:Color [White]</summary>
CellBackColor
''' <summary>unoidl.com.sun.star.util.CellProtection</summary>
CellProtection
''' <summary>System.String def:Default</summary>
CellStyle
''' <summary>System.Int32 def:Color [White]</summary>
CharColor
''' <summary>System.Boolean def:False</summary>
CharContoured
''' <summary>System.Boolean def:False</summary>
CharCrossedOut
''' <summary>System.Int16 def:0</summary>
CharEmphasis
''' <summary>System.Int16 def:5</summary>
CharFont
''' <summary>System.Int16 def:60</summary>
CharFontCharSet
''' <summary>System.Int16 def:60</summary>
CharFontCharSetAsian
''' <summary>System.Int16 def:60</summary>
CharFontCharSetComplex
''' <summary>System.Int16 def:5</summary>
CharFontFamily
''' <summary>System.Int16 def:6</summary>
CharFontFamilyAsian
''' <summary>System.Int16 def:6</summary>
CharFontFamilyComplex
''' <summary>System.String def:Arial</summary>
CharFontName
''' <summary>System.String def:lr oSVbN</summary>
CharFontNameAsian
''' <summary>System.String def:Mangal</summary>
CharFontNameComplex
''' <summary>System.Int16 def:2</summary>
CharFontPitch
''' <summary>System.Int16 def:2</summary>
CharFontPitchAsian
''' <summary>System.Int16 def:2</summary>
CharFontPitchComplex
''' <summary>System.String</summary>
CharFontStyleName
''' <summary>System.String</summary>
CharFontStyleNameAsian
''' <summary>System.String</summary>
CharFontStyleNameComplex
''' <summary>System.Single def:10</summary>
CharHeight
''' <summary>System.Single def:10</summary>
CharHeightAsian
''' <summary>System.Single def:10</summary>
CharHeightComplex
''' <summary>unoidl.com.sun.star.lang.Locale</summary>
CharLocale
''' <summary>unoidl.com.sun.star.lang.Locale</summary>
CharLocaleAsian
''' <summary>unoidl.com.sun.star.lang.Locale</summary>
CharLocaleComplex
''' <summary>System.Int16 def:0</summary>
CharOverline
''' <summary>System.Int32 def:Color [White]</summary>
CharOverlineColor
''' <summary>System.Boolean def:False</summary>
CharOverlineHasColor
''' <summary>unoidl.com.sun.star.awt.FontSlant</summary>
CharPosture
''' <summary>unoidl.com.sun.star.awt.FontSlant</summary>
CharPostureAsian
''' <summary>unoidl.com.sun.star.awt.FontSlant</summary>
CharPostureComplex
''' <summary>System.Int16 def:0</summary>
CharRelief
''' <summary>System.Boolean def:False</summary>
CharShadowed
''' <summary>System.Int16 def:0</summary>
CharStrikeout
''' <summary>System.Boolean def:False</summary>
ChartColumnAsLabel
''' <summary>System.Boolean def:False</summary>
ChartRowAsLabel
''' <summary>System.Int16 def:0</summary>
CharUnderline
''' <summary>System.Int32 def:Color [White]</summary>
CharUnderlineColor
''' <summary>System.Boolean def:False</summary>
CharUnderlineHasColor
''' <summary>System.Single def:100</summary>
CharWeight
''' <summary>System.Single def:100</summary>
CharWeightAsian
''' <summary>System.Single def:190</summary>
CharWeightComplex
''' <summary>System.Boolean def:False</summary>
CharWordMode
''' <summary>unoidl.com.sun.star.sheet.XSheetConditionalEntries</summary>
ConditionalFormat
''' <summary>unoidl.com.sun.star.sheet.XSheetConditionalEntries</summary>
ConditionalFormatLocal
''' <summary>unoidl.com.sun.star.sheet.XSheetConditionalEntries</summary>
ConditionalFormatXML
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
DiagonalBLTR
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
DiagonalTLBR
''' <summary>unoidl.com.sun.star.table.CellHoriJustify</summary>
HoriJustify
''' <summary>System.Boolean def:True</summary>
IsCellBackgroundTransparent
''' <summary>System.Boolean def:False</summary>
IsTextWrapped
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
LeftBorder
''' <summary>System.Int32 def:0</summary>
NumberFormat
''' <summary>unoidl.com.sun.star.container.XIndexReplace</summary>
NumberingRules
''' <summary>unoidl.com.sun.star.table.CellOrientation</summary>
Orientation
''' <summary>System.Int16 def:0</summary>
ParaAdjust
''' <summary>System.Int32 def:35</summary>
ParaBottomMargin
''' <summary>System.Int16 def:0</summary>
ParaIndent
''' <summary>System.Boolean def:False</summary>
ParaIsCharacterDistance
''' <summary>System.Boolean def:False</summary>
ParaIsForbiddenRules
''' <summary>System.Boolean def:False</summary>
ParaIsHangingPunctuation
''' <summary>System.Boolean def:False</summary>
ParaIsHyphenation
''' <summary>System.Int16 def:0</summary>
ParaLastLineAdjust
''' <summary>System.Int32 def:35</summary>
ParaLeftMargin
''' <summary>System.Int32 def:35</summary>
ParaRightMargin
''' <summary>System.Int32 def:35</summary>
ParaTopMargin
''' <summary>unoidl.com.sun.star.awt.Point</summary>
Position
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
RightBorder
''' <summary>System.Int32 def:0</summary>
RotateAngle
''' <summary>unoidl.com.sun.star.table.CellVertJustify</summary>
RotateReference
''' <summary>unoidl.com.sun.star.table.ShadowFormat</summary>
ShadowFormat
''' <summary>System.Boolean def:False</summary>
ShrinkToFit
''' <summary>unoidl.com.sun.star.awt.Size</summary>
Size
''' <summary>unoidl.com.sun.star.table.TableBorder</summary>
TableBorder
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
TopBorder
''' <summary>unoidl.com.sun.star.container.XNameContainer</summary>
UserDefinedAttributes
''' <summary>unoidl.com.sun.star.beans.XPropertySet</summary>
Validation
''' <summary>unoidl.com.sun.star.beans.XPropertySet</summary>
ValidationLocal
''' <summary>unoidl.com.sun.star.beans.XPropertySet</summary>
ValidationXML
''' <summary>unoidl.com.sun.star.table.CellVertJustify</summary>
VertJustify
''' <summary>System.Int16 def:4</summary>
WritingMode
End
Enum
''' <summary>
''' Calc
PageSetup Property
''' </summary>
Enum
enmCalcPageSetupPpt As Integer
''' <summary>System.Int32 def:Color [White]</summary>
BackColor
''' <summary>System.String</summary>
BackGraphicFilter
''' <summary>unoidl.com.sun.star.style.GraphicLocation</summary>
BackGraphicLocation
''' <summary>System.String</summary>
BackGraphicURL
''' <summary>System.Int32 def:Color [White]</summary>
BackgroundColor
''' <summary>System.Boolean def:True</summary>
BackTransparent
''' <summary>System.Int32 def:0</summary>
BorderDistance
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
BottomBorder
''' <summary>System.Int32 def:0</summary>
BottomBorderDistance
''' <summary>System.Int32 def:2000</summary>
BottomMargin
''' <summary>System.Boolean def:False</summary>
CenterHorizontally
''' <summary>System.Boolean def:False</summary>
CenterVertically
''' <summary>System.String(ReadOnly) def:W</summary>
DisplayName
''' <summary>System.Int16 def:1</summary>
FirstPageNumber
''' <summary>System.Int32 def:Color [White]</summary>
FooterBackColor
''' <summary>System.String</summary>
FooterBackGraphicFilter
''' <summary>unoidl.com.sun.star.style.GraphicLocation</summary>
FooterBackGraphicLocation
''' <summary>System.String</summary>
FooterBackGraphicURL
''' <summary>System.Int32 def:Color [White]</summary>
FooterBackgroundColor
''' <summary>System.Boolean def:True</summary>
FooterBackTransparent
''' <summary>System.Int32 def:250</summary>
FooterBodyDistance
''' <summary>System.Int32 def:0</summary>
FooterBorderDistance
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
FooterBottomBorder
''' <summary>System.Int32 def:0</summary>
FooterBottomBorderDistance
''' <summary>System.Boolean def:True</summary>
FooterDynamic
''' <summary>System.Int32 def:751</summary>
FooterHeight
''' <summary>System.Boolean def:True</summary>
FooterIsDynamicHeight
''' <summary>System.Boolean def:True</summary>
FooterIsOn
''' <summary>System.Boolean def:True</summary>
FooterIsShared
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
FooterLeftBorder
''' <summary>System.Int32 def:0</summary>
FooterLeftBorderDistance
''' <summary>System.Int32 def:0</summary>
FooterLeftMargin
'''
<summary>System.Boolean
def:True</summary>
FooterOn
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
FooterRightBorder
''' <summary>System.Int32 def:0</summary>
FooterRightBorderDistance
''' <summary>System.Int32 def:0</summary>
FooterRightMargin
''' <summary>unoidl.com.sun.star.table.ShadowFormat</summary>
FooterShadowFormat
''' <summary>System.Boolean def:True</summary>
FooterShared
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
FooterTopBorder
''' <summary>System.Int32 def:0</summary>
FooterTopBorderDistance
''' <summary>System.Int32 def:Color [White]</summary>
HeaderBackColor
''' <summary>System.String</summary>
HeaderBackGraphicFilter
''' <summary>unoidl.com.sun.star.style.GraphicLocation</summary>
HeaderBackGraphicLocation
''' <summary>System.String</summary>
HeaderBackGraphicURL
''' <summary>System.Int32 def:Color [White]</summary>
HeaderBackgroundColor
''' <summary>System.Boolean def:True</summary>
HeaderBackTransparent
''' <summary>System.Int32 def:250</summary>
HeaderBodyDistance
''' <summary>System.Int32 def:0</summary>
HeaderBorderDistance
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
HeaderBottomBorder
''' <summary>System.Int32 def:0</summary>
HeaderBottomBorderDistance
''' <summary>System.Boolean def:True</summary>
HeaderDynamic
''' <summary>System.Int32 def:751</summary>
HeaderHeight
''' <summary>System.Boolean def:True</summary>
HeaderIsDynamicHeight
''' <summary>System.Boolean def:True</summary>
HeaderIsOn
''' <summary>System.Boolean def:True</summary>
HeaderIsShared
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
HeaderLeftBorder
''' <summary>System.Int32 def:0</summary>
HeaderLeftBorderDistance
''' <summary>System.Int32 def:0</summary>
HeaderLeftMargin
''' <summary>System.Boolean def:True</summary>
HeaderOn
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
HeaderRightBorder
''' <summary>System.Int32 def:0</summary>
HeaderRightBorderDistance
'''
<summary>System.Int32
def:0</summary>
HeaderRightMargin
''' <summary>unoidl.com.sun.star.table.ShadowFormat</summary>
HeaderShadowFormat
''' <summary>System.Boolean def:True</summary>
HeaderShared
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
HeaderTopBorder
''' <summary>System.Int32 def:0</summary>
HeaderTopBorderDistance
''' <summary>System.Int32 def:29700</summary>
Height
''' <summary>System.Boolean def:True</summary>
IsBackgroundTransparent
''' <summary>System.Boolean (Should use PaperOrientation in Landscape
set) def:False</summary>
IsLandscape
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
LeftBorder
''' <summary>System.Int32 def:0</summary>
LeftBorderDistance
''' <summary>System.Int32 def:2000</summary>
LeftMargin
''' <summary>unoidl.com.sun.star.sheet.XHeaderFooterContent</summary>
LeftPageFooterContent
''' <summary>unoidl.com.sun.star.sheet.XHeaderFooterContent</summary>
LeftPageHeaderContent
''' <summary>System.Int16 def:4</summary>
NumberingType
''' <summary>System.Int16 def:100</summary>
PageScale
''' <summary>unoidl.com.sun.star.style.PageStyleLayout</summary>
PageStyleLayout
''' <summary>System.Boolean def:False</summary>
PrintAnnotations
''' <summary>System.Boolean def:True</summary>
PrintCharts
''' <summary>System.Boolean def:True</summary>
PrintDownFirst
''' <summary>System.Boolean def:true</summary>
PrintDrawing
''' <summary>System.String def:[From printer settings]</summary>
PrinterPaperTray
''' <summary>System.Boolean def:False</summary>
PrintFormulas
''' <summary>System.Boolean
def:False</summary>
PrintGrid
''' <summary>System.Boolean def:False</summary>
PrintHeaders
''' <summary>System.Boolean def:True</summary>
PrintObjects
''' <summary>System.Boolean def:True</summary>
PrintZeroValues
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
RightBorder
''' <summary>System.Int32 def:0</summary>
RightBorderDistance
''' <summary>System.Int32 def:2000</summary>
RightMargin
''' <summary>unoidl.com.sun.star.sheet.XHeaderFooterContent</summary>
RightPageFooterContent
''' <summary>unoidl.com.sun.star.sheet.XHeaderFooterContent</summary>
RightPageHeaderContent
''' <summary>System.Int16 def:0</summary>
ScaleToPages
''' <summary>System.Int16 def:0</summary>
ScaleToPagesX
''' <summary>System.Int16 def:0</summary>
ScaleToPagesY
''' <summary>unoidl.com.sun.star.table.ShadowFormat</summary>
ShadowFormat
''' <summary>unoidl.com.sun.star.awt.Size</summary>
Size
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
TopBorder
''' <summary>System.Int32 def:0</summary>
TopBorderDistance
''' <summary>System.Int32 def:2000</summary>
TopMargin
''' <summary>System.Boolean def:True</summary>
TransparentFooterBackground
''' <summary>System.Boolean def:True</summary>
TransparentHeaderBackground
''' <summary>unoidl.com.sun.star.container.XNameContainer</summary>
UserDefinedAttributes
''' <summary>System.Int32 def:21001</summary>
Width
''' <summary>System.Int16 def:0</summary>
WritingMode
End
Enum
''' <summary>
''' Calc
Cell Property
''' </summary>
Enum
enmCalcCellPpt As Integer
''' <summary>System.Boolean def:False</summary>
AsianVerticalMode
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
BottomBorder
''' <summary>System.Int32 def:Color [White]</summary>
CellBackColor
''' <summary>unoidl.com.sun.star.util.CellProtection</summary>
CellProtection
''' <summary>System.Int32 def:Color [White]</summary>
CharColor
''' <summary>System.Boolean def:False</summary>
CharContoured
''' <summary>System.Boolean
def:False</summary>
CharCrossedOut
''' <summary>System.Int16 def:0</summary>
CharEmphasis
''' <summary>System.Int16 def:5</summary>
CharFont
''' <summary>System.Int16 def:60</summary>
CharFontCharSet
''' <summary>System.Int16 def:60</summary>
CharFontCharSetAsian
''' <summary>System.Int16 def:60</summary>
CharFontCharSetComplex
''' <summary>System.Int16 def:5</summary>
CharFontFamily
''' <summary>System.Int16 def:6</summary>
CharFontFamilyAsian
''' <summary>System.Int16 def:6</summary>
CharFontFamilyComplex
''' <summary>System.String def:Arial</summary>
CharFontName
''' <summary>System.String def:lr oSVbN</summary>
CharFontNameAsian
''' <summary>System.String def:Mangal</summary>
CharFontNameComplex
''' <summary>System.Int16 def:2</summary>
CharFontPitch
''' <summary>System.Int16 def:2</summary>
CharFontPitchAsian
''' <summary>System.Int16 def:2</summary>
CharFontPitchComplex
''' <summary>System.String</summary>
CharFontStyleName
''' <summary>System.String</summary>
CharFontStyleNameAsian
''' <summary>System.String</summary>
CharFontStyleNameComplex
''' <summary>System.Single def:10</summary>
CharHeight
''' <summary>System.Single def:10</summary>
CharHeightAsian
''' <summary>System.Single def:10</summary>
CharHeightComplex
''' <summary>unoidl.com.sun.star.lang.Locale</summary>
CharLocale
''' <summary>unoidl.com.sun.star.lang.Locale</summary>
CharLocaleAsian
''' <summary>unoidl.com.sun.star.lang.Locale</summary>
CharLocaleComplex
''' <summary>System.Int16 def:0</summary>
CharOverline
''' <summary>System.Int32 def:Color [White]</summary>
CharOverlineColor
''' <summary>System.Boolean def:False</summary>
CharOverlineHasColor
''' <summary>unoidl.com.sun.star.awt.FontSlant</summary>
CharPosture
''' <summary>unoidl.com.sun.star.awt.FontSlant</summary>
CharPostureAsian
''' <summary>unoidl.com.sun.star.awt.FontSlant</summary>
CharPostureComplex
''' <summary>System.Int16 def:0</summary>
CharRelief
''' <summary>System.Boolean def:False</summary>
CharShadowed
''' <summary>System.Int16 def:0</summary>
CharStrikeout
''' <summary>System.Int16 def:0</summary>
CharUnderline
''' <summary>System.Int32 def:Color [White]</summary>
CharUnderlineColor
''' <summary>System.Boolean def:False</summary>
CharUnderlineHasColor
''' <summary>System.Single def:100</summary>
CharWeight
''' <summary>System.Single def:100</summary>
CharWeightAsian
''' <summary>System.Single def:100</summary>
CharWeightComplex
''' <summary>System.Boolean def:False</summary>
CharWordMode
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
DiagonalBLTR
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
DiagonalTLBR
''' <summary>System.String(ReadOnly) def:W</summary>
DisplayName
''' <summary>unoidl.com.sun.star.table.CellHoriJustify</summary>
HoriJustify
''' <summary>System.Boolean def:True</summary>
IsCellBackgroundTransparent
''' <summary>System.Boolean def:False</summary>
IsTextWrapped
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
LeftBorder
''' <summary>System.Int32 def:0</summary>
NumberFormat
''' <summary>unoidl.com.sun.star.table.CellOrientation</summary>
Orientation
''' <summary>System.Int16 def:0</summary>
ParaAdjust
''' <summary>System.Int32 def:35</summary>
ParaBottomMargin
''' <summary>System.Int16 def:0</summary>
ParaIndent
''' <summary>System.Boolean def:False</summary>
ParaIsCharacterDistance
''' <summary>System.Boolean def:False</summary>
ParaIsForbiddenRules
''' <summary>System.Boolean def:False</summary>
ParaIsHangingPunctuation
''' <summary>System.Boolean def:False</summary>
ParaIsHyphenation
''' <summary>System.Int16 def:0</summary>
ParaLastLineAdjust
''' <summary>System.Int32 def:35</summary>
ParaLeftMargin
''' <summary>System.Int32 def:35</summary>
ParaRightMargin
''' <summary>System.Int32 def:35</summary>
ParaTopMargin
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
RightBorder
''' <summary>System.Int32 def:0</summary>
RotateAngle
''' <summary>unoidl.com.sun.star.table.CellVertJustify</summary>
RotateReference
''' <summary>unoidl.com.sun.star.table.ShadowFormat</summary>
ShadowFormat
''' <summary>System.Boolean def:False</summary>
ShrinkToFit
''' <summary>unoidl.com.sun.star.table.TableBorder</summary>
TableBorder
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
TopBorder
''' <summary>unoidl.com.sun.star.container.XNameContainer</summary>
UserDefinedAttributes
''' <summary>unoidl.com.sun.star.table.CellVertJustify</summary>
VertJustify
''' <summary>System.Int16 def:4</summary>
WritingMode
End
Enum
''' <summary>
''' Calc XShape
Property
''' </summary>
Enum enmCalcXShapePpt As Integer
''' <summary>System.Int16
def:Nothing</summary>
AdjustBlue
''' <summary>System.Int16
def:Nothing</summary>
AdjustContrast
''' <summary>System.Int16
def:Nothing</summary>
AdjustGreen
''' <summary>System.Int16
def:Nothing</summary>
AdjustLuminance
''' <summary>System.Int16
def:Nothing</summary>
AdjustRed
''' <summary>System.Object
def:Nothing</summary>
Anchor
''' <summary>unoidl.com.sun.star.awt.XBitmap(ReadOnly)
def:Nothing</summary>
Bitmap
''' <summary>unoidl.com.sun.star.awt.Rectangle(ReadOnly)
def:Nothing</summary>
BoundRect
''' <summary>System.Boolean
def:Nothing</summary>
CharAutoKerning
''' <summary>System.Int32
def:Nothing</summary>
CharColor
''' <summary>System.Boolean
def:Nothing</summary>
CharContoured
''' <summary>System.Boolean
def:Nothing</summary>
CharCrossedOut
''' <summary>System.Int16
def:Nothing</summary>
CharEmphasis
''' <summary>System.Int16
def:Nothing</summary>
CharEscapement
''' <summary>System.Byte
def:Nothing</summary>
CharEscapementHeight
''' <summary>System.Int16
def:Nothing</summary>
CharFontCharSet
''' <summary>System.Int16
def:Nothing</summary>
CharFontCharSetAsian
''' <summary>System.Int16
def:Nothing</summary>
CharFontCharSetComplex
''' <summary>System.Int16
def:Nothing</summary>
CharFontFamily
''' <summary>System.Int16
def:Nothing</summary>
CharFontFamilyAsian
''' <summary>System.Int16
def:Nothing</summary>
CharFontFamilyComplex
''' <summary>System.String
def:Nothing</summary>
CharFontName
''' <summary>System.String
def:Nothing</summary>
CharFontNameAsian
''' <summary>System.String
def:Nothing</summary>
CharFontNameComplex
''' <summary>System.Int16
def:Nothing</summary>
CharFontPitch
''' <summary>System.Int16
def:Nothing</summary>
CharFontPitchAsian
''' <summary>System.Int16
def:Nothing</summary>
CharFontPitchComplex
''' <summary>System.String
def:Nothing</summary>
CharFontStyleName
''' <summary>System.String
def:Nothing</summary>
CharFontStyleNameAsian
''' <summary>System.String
def:Nothing</summary>
CharFontStyleNameComplex
''' <summary>System.Single
def:Nothing</summary>
CharHeight
''' <summary>System.Single
def:Nothing</summary>
CharHeightAsian
''' <summary>System.Single
def:Nothing</summary>
CharHeightComplex
''' <summary>System.Int16
def:Nothing</summary>
CharKerning
''' <summary>unoidl.com.sun.star.lang.Locale
def:Nothing</summary>
CharLocale
''' <summary>unoidl.com.sun.star.lang.Locale
def:Nothing</summary>
CharLocaleAsian
''' <summary>unoidl.com.sun.star.lang.Locale
def:Nothing</summary>
CharLocaleComplex
''' <summary>System.Int16
def:Nothing</summary>
CharOverline
''' <summary>System.Int32
def:Nothing</summary>
CharOverlineColor
''' <summary>System.Boolean
def:Nothing</summary>
CharOverlineHasColor
''' <summary>unoidl.com.sun.star.awt.FontSlant
def:Nothing</summary>
CharPosture
''' <summary>unoidl.com.sun.star.awt.FontSlant
def:Nothing</summary>
CharPostureAsian
''' <summary>unoidl.com.sun.star.awt.FontSlant
def:Nothing</summary>
CharPostureComplex
''' <summary>System.Int16
def:Nothing</summary>
CharRelief
''' <summary>System.Int16
def:Nothing</summary>
CharScaleWidth
''' <summary>System.Boolean
def:Nothing</summary>
CharShadowed
''' <summary>System.Int16
def:Nothing</summary>
CharStrikeout
''' <summary>System.Int16
def:Nothing</summary>
CharUnderline
''' <summary>System.Int32
def:Nothing</summary>
CharUnderlineColor
''' <summary>System.Boolean
def:Nothing</summary>
CharUnderlineHasColor
''' <summary>System.Single
def:Nothing</summary>
CharWeight
''' <summary>System.Single def:Nothing</summary>
CharWeightAsian
''' <summary>System.Single
def:Nothing</summary>
CharWeightComplex
''' <summary>System.Boolean
def:Nothing</summary>
CharWordMode
''' <summary>System.String
def:Nothing</summary>
Description
''' <summary>System.Boolean
def:Nothing</summary>
FillBackground
''' <summary>unoidl.com.sun.star.awt.XBitmap
def:Nothing</summary>
FillBitmap
''' <summary>System.Boolean
def:Nothing</summary>
FillBitmapLogicalSize
''' <summary>unoidl.com.sun.star.drawing.BitmapMode
def:Nothing</summary>
FillBitmapMode
''' <summary>System.String
def:Nothing</summary>
FillBitmapName
''' <summary>System.Int32
def:Nothing</summary>
FillBitmapOffsetX
''' <summary>System.Int32
def:Nothing</summary>
FillBitmapOffsetY
''' <summary>System.Int32
def:Nothing</summary>
FillBitmapPositionOffsetX
''' <summary>System.Int32
def:Nothing</summary>
FillBitmapPositionOffsetY
''' <summary>unoidl.com.sun.star.drawing.RectanglePoint
def:Nothing</summary>
FillBitmapRectanglePoint
''' <summary>System.Int32
def:Nothing</summary>
FillBitmapSizeX
''' <summary>System.Int32
def:Nothing</summary>
FillBitmapSizeY
''' <summary>System.Boolean
def:Nothing</summary>
FillBitmapStretch
''' <summary>System.Boolean
def:Nothing</summary>
FillBitmapTile
''' <summary>System.String
def:Nothing</summary>
FillBitmapURL
''' <summary>System.Int32
def:Nothing</summary>
FillColor
''' <summary>System.Int32
def:Nothing</summary>
FillColor2
''' <summary>unoidl.com.sun.star.awt.Gradient
def:Nothing</summary>
FillGradient
''' <summary>System.String def:Nothing</summary>
FillGradientName
''' <summary>System.Int16
def:Nothing</summary>
FillGradientStepCount
''' <summary>unoidl.com.sun.star.drawing.Hatch
def:Nothing</summary>
FillHatch
''' <summary>System.String
def:Nothing</summary>
FillHatchName
''' <summary>unoidl.com.sun.star.drawing.FillStyle
def:Nothing</summary>
FillStyle
''' <summary>System.Int16
def:Nothing</summary>
FillTransparence
''' <summary>unoidl.com.sun.star.awt.Gradient
def:Nothing</summary>
FillTransparenceGradient
''' <summary>System.String
def:Nothing</summary>
FillTransparenceGradientName
''' <summary>System.Boolean
def:Nothing</summary>
FontIndependentLineSpacing
''' <summary>System.Int32
def:Nothing</summary>
FontWorkAdjust
''' <summary>System.Int32
def:Nothing</summary>
FontWorkDistance
''' <summary>System.Boolean
def:Nothing</summary>
FontWorkHideForm
''' <summary>System.Boolean
def:Nothing</summary>
FontWorkMirror
''' <summary>System.Boolean
def:Nothing</summary>
FontWorkOutline
''' <summary>System.Int32
def:Nothing</summary>
FontWorkShadow
''' <summary>System.Int32
def:Nothing</summary>
FontWorkShadowColor
''' <summary>System.Int32
def:Nothing</summary>
FontWorkShadowOffsetX
''' <summary>System.Int32
def:Nothing</summary>
FontWorkShadowOffsetY
''' <summary>System.Int16
def:Nothing</summary>
FontWorkShadowTransparence
''' <summary>System.Int32
def:Nothing</summary>
FontWorkStart
''' <summary>System.Int32
def:Nothing</summary>
FontWorkStyle
''' <summary>unoidl.com.sun.star.awt.Rectangle
def:Nothing</summary>
FrameRect
''' <summary>System.Double
def:Nothing</summary>
Gamma
''' <summary>unoidl.com.sun.star.graphic.XGraphic
def:Nothing</summary>
Graphic
''' <summary>unoidl.com.sun.star.drawing.ColorMode
def:Nothing</summary>
GraphicColorMode
''' <summary>unoidl.com.sun.star.text.GraphicCrop
def:Nothing</summary>
GraphicCrop
''' <summary>unoidl.com.sun.star.awt.XBitmap
def:Nothing</summary>
GraphicObjectFillBitmap
''' <summary>unoidl.com.sun.star.io.XInputStream(ReadOnly)
def:Nothing</summary>
GraphicStream
''' <summary>System.String
def:Nothing</summary>
GraphicStreamURL
''' <summary>System.String
def:Nothing</summary>
GraphicURL
''' <summary>System.Int32
def:Nothing</summary>
HoriOrientPosition
''' <summary>unoidl.com.sun.star.container.XIndexContainer
def:Nothing</summary>
ImageMap
''' <summary>System.Boolean(ReadOnly)
def:Nothing</summary>
IsFontwork
''' <summary>System.Boolean
def:Nothing</summary>
IsMirrored
''' <summary>System.Int16
def:Nothing</summary>
LayerID
''' <summary>System.String
def:Nothing</summary>
LayerName
''' <summary>unoidl.com.sun.star.drawing.LineCap
def:Nothing</summary>
LineCap
''' <summary>System.Int32
def:Nothing</summary>
LineColor
''' <summary>unoidl.com.sun.star.drawing.LineDash
def:Nothing</summary>
LineDash
''' <summary>System.String
def:Nothing</summary>
LineDashName
''' <summary>unoidl.com.sun.star.drawing.PolyPolygonBezierCoords
def:Nothing</summary>
LineEnd
''' <summary>System.Boolean
def:Nothing</summary>
LineEndCenter
''' <summary>System.String
def:Nothing</summary>
LineEndName
''' <summary>System.Int32
def:Nothing</summary>
LineEndWidth
''' <summary>unoidl.com.sun.star.drawing.LineJoint
def:Nothing</summary>
LineJoint
''' <summary>unoidl.com.sun.star.drawing.PolyPolygonBezierCoords
def:Nothing</summary>
LineStart
''' <summary>System.Boolean
def:Nothing</summary>
LineStartCenter
''' <summary>System.String
def:Nothing</summary>
LineStartName
''' <summary>System.Int32
def:Nothing</summary>
LineStartWidth
''' <summary>unoidl.com.sun.star.drawing.LineStyle
def:Nothing</summary>
LineStyle
''' <summary>System.Int16
def:Nothing</summary>
LineTransparence
''' <summary>System.Int32
def:Nothing</summary>
LineWidth
''' <summary>unoidl.com.sun.star.awt.XBitmap(ReadOnly)
def:Nothing</summary>
LinkDisplayBitmap
''' <summary>System.String(ReadOnly)
def:Nothing</summary>
LinkDisplayName
''' <summary>System.Byte[](ReadOnly)
def:Nothing</summary>
MetaFile
''' <summary>System.Boolean def:Nothing</summary>
MoveProtect
''' <summary>System.String
def:Nothing</summary>
Name
''' <summary>System.Boolean
def:Nothing</summary>
NumberingIsNumber
''' <summary>unoidl.com.sun.star.container.XIndexReplace
def:Nothing</summary>
NumberingRules
''' <summary>System.Int16
def:Nothing</summary>
ParaAdjust
''' <summary>System.Int32
def:Nothing</summary>
ParaBottomMargin
''' <summary>System.Int32
def:Nothing</summary>
ParaFirstLineIndent
''' <summary>System.Boolean
def:Nothing</summary>
ParaIsCharacterDistance
''' <summary>System.Boolean
def:Nothing</summary>
ParaIsForbiddenRules
''' <summary>System.Boolean
def:Nothing</summary>
ParaIsHangingPunctuation
''' <summary>System.Boolean
def:Nothing</summary>
ParaIsHyphenation
''' <summary>System.Int16
def:Nothing</summary>
ParaLastLineAdjust
''' <summary>System.Int32
def:Nothing</summary>
ParaLeftMargin
''' <summary>unoidl.com.sun.star.style.LineSpacing
def:Nothing</summary>
ParaLineSpacing
''' <summary>System.Int32
def:Nothing</summary>
ParaRightMargin
''' <summary>unoidl.com.sun.star.style.TabStop[]
def:Nothing</summary>
ParaTabStops
''' <summary>System.Int32
def:Nothing</summary>
ParaTopMargin
''' <summary>unoidl.com.sun.star.container.XNameContainer
def:Nothing</summary>
ParaUserDefinedAttributes
''' <summary>System.Boolean
def:Nothing</summary>
Printable
''' <summary>System.String
def:Nothing</summary>
ReplacementGraphicURL
''' <summary>System.Int32
def:Nothing</summary>
RotateAngle
''' <summary>System.Boolean
def:Nothing</summary>
Shadow
''' <summary>System.Int32
def:Nothing</summary>
ShadowColor
''' <summary>System.Int16
def:Nothing</summary>
ShadowTransparence
''' <summary>System.Int32
def:Nothing</summary>
ShadowXDistance
''' <summary>System.Int32
def:Nothing</summary>
ShadowYDistance
''' <summary>System.Int32
def:Nothing</summary>
ShearAngle
''' <summary>System.Boolean
def:Nothing</summary>
SizeProtect
''' <summary>System.Int16
def:Nothing</summary>
TextAnimationAmount
''' <summary>System.Int16
def:Nothing</summary>
TextAnimationCount
''' <summary>System.Int16
def:Nothing</summary>
TextAnimationDelay
''' <summary>unoidl.com.sun.star.drawing.TextAnimationDirection
def:Nothing</summary>
TextAnimationDirection
''' <summary>unoidl.com.sun.star.drawing.TextAnimationKind
def:Nothing</summary>
TextAnimationKind
''' <summary>System.Boolean
def:Nothing</summary>
TextAnimationStartInside
''' <summary>System.Boolean
def:Nothing</summary>
TextAnimationStopInside
''' <summary>System.Boolean
def:Nothing</summary>
TextAutoGrowHeight
''' <summary>System.Boolean
def:Nothing</summary>
TextAutoGrowWidth
''' <summary>System.Boolean
def:Nothing</summary>
TextContourFrame
''' <summary>unoidl.com.sun.star.drawing.TextFitToSizeType
def:Nothing</summary>
TextFitToSize
''' <summary>unoidl.com.sun.star.drawing.TextHorizontalAdjust
def:Nothing</summary>
TextHorizontalAdjust
''' <summary>System.Int32
def:Nothing</summary>
TextLeftDistance
''' <summary>System.Int32
def:Nothing</summary>
TextLowerDistance
''' <summary>System.Int32
def:Nothing</summary>
TextMaximumFrameHeight
''' <summary>System.Int32
def:Nothing</summary>
TextMaximumFrameWidth
''' <summary>System.Int32
def:Nothing</summary>
TextMinimumFrameHeight
''' <summary>System.Int32
def:Nothing</summary>
TextMinimumFrameWidth
''' <summary>System.Int32
def:Nothing</summary>
TextRightDistance
''' <summary>System.Int32
def:Nothing</summary>
TextUpperDistance
''' <summary>unoidl.com.sun.star.drawing.TextVerticalAdjust
def:Nothing</summary>
TextVerticalAdjust
''' <summary>System.Boolean
def:Nothing</summary>
TextWordWrap
''' <summary>unoidl.com.sun.star.text.WritingMode
def:Nothing</summary>
TextWritingMode
''' <summary>System.String
def:Nothing</summary>
Title
''' <summary>unoidl.com.sun.star.drawing.HomogenMatrix3
def:Nothing</summary>
Transformation
''' <summary>System.Int16
def:Nothing</summary>
Transparency
''' <summary>System.String(ReadOnly)
def:Nothing</summary>
UINamePlural
''' <summary>System.String(ReadOnly)
def:Nothing</summary>
UINameSingular
''' <summary>unoidl.com.sun.star.container.XNameContainer
def:Nothing</summary>
UserDefinedAttributes
''' <summary>System.Int32
def:Nothing</summary>
VertOrientPosition
''' <summary>System.Boolean
def:Nothing</summary>
Visible
''' <summary>System.Int16
def:Nothing</summary>
WritingMode
''' <summary>System.Int32
def:Nothing</summary>
ZOrder
End Enum
''' <summary>
'''
Writer PageSetup Property
''' </summary>
Enum
enmWrtrPageSetupPpt As Integer
''' <summary>System.Int32 def:Color [White]</summary>
BackColor
''' <summary>System.String</summary>
BackGraphicFilter
''' <summary>unoidl.com.sun.star.style.GraphicLocation</summary>
BackGraphicLocation
'''' <summary>System.String</summary>
'BackGraphicURL
'''' <summary>System.Int32 def:Color
[White]</summary>
'BackgroundColor
''' <summary>System.Boolean def:True</summary>
BackTransparent
''' <summary>System.Int32 def:0</summary>
BorderDistance
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
BottomBorder
''' <summary>System.Int32 def:0</summary>
BottomBorderDistance
''' <summary>System.Int32 def:2000</summary>
BottomMargin
'''' <summary>System.Boolean
def:False</summary>
'CenterHorizontally
'''' <summary>System.Boolean
def:False</summary>
'CenterVertically
''' <summary>System.String(ReadOnly) def:W</summary>
DisplayName
''' <summary>System.String def:Standard</summary>
FollowStyle
''' <summary>System.Int32 def:Color [White]</summary>
FooterBackColor
''' <summary>System.String</summary>
FooterBackGraphicFilter
''' <summary>unoidl.com.sun.star.style.GraphicLocation</summary>
FooterBackGraphicLocation
''' <summary>System.String</summary>
FooterBackGraphicURL
'''' <summary>System.Int32 def:Color [White]</summary>
'FooterBackgroundColor
''' <summary>System.Boolean def:true</summary>
FooterBackTransparent
''' <summary>System.Int32 def:250</summary>
FooterBodyDistance
''' <summary>System.Int32 def:0</summary>
FooterBorderDistance
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
FooterBottomBorder
''' <summary>System.Int32 def:0</summary>
FooterBottomBorderDistance
''' <summary>System.Boolean def:True</summary>
FooterDynamicSpacing
''' <summary>System.Int32 def:751</summary>
FooterHeight
''' <summary>System.Boolean def:True</summary>
FooterIsDynamicHeight
''' <summary>System.Boolean def:True</summary>
FooterIsOn
''' <summary>System.Boolean def:True</summary>
FooterIsShared
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
FooterLeftBorder
''' <summary>System.Int32 def:0</summary>
FooterLeftBorderDistance
''' <summary>System.Int32 def:0</summary>
FooterLeftMargin
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
FooterRightBorder
''' <summary>System.Int32 def:0</summary>
FooterRightBorderDistance
''' <summary>System.Int32 def:0</summary>
FooterRightMargin
''' <summary>unoidl.com.sun.star.table.ShadowFormat</summary>
FooterShadowFormat
''' <summary>System.Boolean def:True</summary>
FooterShared
''' <summary>unoidl.com.sun.star.text.XText(ReadOnly)</summary>
FooterText
''' <summary>unoidl.com.sun.star.text.XText(ReadOnly)</summary>
FooterTextLeft
''' <summary>unoidl.com.sun.star.text.XText(ReadOnly)</summary>
FooterTextRight
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
FooterTopBorder
''' <summary>System.Int32 def:0</summary>
FooterTopBorderDistance
''' <summary>System.Int32 def:0</summary>
FootnoteHeight
''' <summary>System.Int16 def:0</summary>
FootnoteLineAdjust
'''' <summary>System.Int32 def:Color [Black]</summary>
FootnoteLineColor
'''' <summary>System.Int32 def:101</summary>
FootnoteLineDistance
'''' <summary>System.Byte</summary>
FootnoteLineRelativeWidth
'''' <summary>System.Int32 def:101</summary>
FootnoteLineTextDistance
'''' <summary>System.Int16 def:18</summary>
FootnoteLineWeight
'''' <summary>System.Int32 def:706</summary>
GridBaseHeight
'''' <summary>System.Int32 def:706</summary>
GridBaseWidth
'''' <summary>System.Int32 def:Color
[Silver]</summary>
GridColor
'''' <summary>System.Boolean def:True</summary>
GridDisplay
'''' <summary>System.Int16 def:20</summary>
GridLines
'''' <summary>System.Int16 def:0</summary>
GridMode
'''' <summary>System.Boolean def:True</summary>
GridPrint
'''' <summary>System.Int32 def:353</summary>
GridRubyHeight
'''' <summary>System.Boolean def:True</summary>
GridSnapToChars
''' <summary>System.Int32 def:Color [White]</summary>
HeaderBackColor
''' <summary>System.String</summary>
HeaderBackGraphicFilter
''' <summary>unoidl.com.sun.star.style.GraphicLocation</summary>
HeaderBackGraphicLocation
''' <summary>System.String</summary>
HeaderBackGraphicURL
'''' <summary>System.Int32 def:Color
[White]</summary>
'HeaderBackgroundColor
''' <summary>System.Boolean def:True</summary>
HeaderBackTransparent
''' <summary>System.Int32 def:250</summary>
HeaderBodyDistance
''' <summary>System.Int32 def:0</summary>
HeaderBorderDistance
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
HeaderBottomBorder
''' <summary>System.Int32 def:0</summary>
HeaderBottomBorderDistance
''' <summary>System.Boolean def:True</summary>
HeaderDynamicSpacing
''' <summary>System.Int32 def:751</summary>
HeaderHeight
''' <summary>System.Boolean def:True</summary>
HeaderIsDynamicHeight
''' <summary>System.Boolean def:True</summary>
HeaderIsOn
''' <summary>System.Boolean def:True</summary>
HeaderIsShared
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
HeaderLeftBorder
''' <summary>System.Int32 def:0</summary>
HeaderLeftBorderDistance
''' <summary>System.Int32 def:0</summary>
HeaderLeftMargin
'''' <summary>System.Boolean def:True</summary>
'HeaderOn
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
HeaderRightBorder
''' <summary>System.Int32 def:0</summary>
HeaderRightBorderDistance
''' <summary>System.Int32 def:0</summary>
HeaderRightMargin
''' <summary>unoidl.com.sun.star.table.ShadowFormat</summary>
HeaderShadowFormat
'''' <summary>System.Boolean def:True</summary>
'HeaderShared
''' <summary>unoidl.com.sun.star.text.XText(ReadOnly)</summary>
HeaderText
''' <summary>unoidl.com.sun.star.text.XText(ReadOnly)</summary>
HeaderTextLeft
''' <summary>unoidl.com.sun.star.text.XText(ReadOnly)</summary>
HeaderTextRight
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
HeaderTopBorder
''' <summary>System.Int32 def:0</summary>
HeaderTopBorderDistance
''' <summary>System.Int32 def:29700</summary>
Height
'''' <summary>System.Boolean def:True</summary>
'IsBackgroundTransparent
''' <summary>System.Boolean (Should use PaperOrientation in Landscape
set) def:False</summary>
IsLandscape
''' <summary>System.Boolean(ReadOnly) def:True</summary>
IsPhysical
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
LeftBorder
''' <summary>System.Int32 def:0</summary>
LeftBorderDistance
''' <summary>System.Int32 def:2000</summary>
LeftMargin
''''
<summary>unoidl.com.sun.star.sheet.XHeaderFooterContent</summary>
'LeftPageFooterContent
''''
<summary>unoidl.com.sun.star.sheet.XHeaderFooterContent</summary>
'LeftPageHeaderContent
'''' <summary>System.Int16 def:4</summary>
NumberingType
'''' <summary>System.Int16 def:100</summary>
'PageScale
''' <summary>unoidl.com.sun.star.style.PageStyleLayout</summary>
PageStyleLayout
'''' <summary>System.String def:False</summary>
'PrintAnnotations
'''' <summary>System.Boolean def:True</summary>
'PrintCharts
'''' <summary>System.Boolean def:True</summary>
'PrintDownFirst
'''' <summary>System.Boolean def:True</summary>
'PrintDrawing
''' <summary>System.String def:[From printer settings]</summary>
PrinterPaperTray
'''' <summary>System.Boolean
def:False</summary>
'PrintFormulas
'''' <summary>System.Boolean
def:False</summary>
'PrintGrid
'''' <summary>System.Boolean
def:False</summary>
'PrintHeaders
'''' <summary>System.Boolean def:True</summary>
'PrintObjects
'''' <summary>System.Boolean def:True</summary>
'PrintZeroValues
''' <summary>System.String</summary>
RegisterParagraphStyle
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
RightBorder
''' <summary>System.Int32 def:0</summary>
RightBorderDistance
''' <summary>System.Int32 def:2000</summary>
RightMargin
''''
<summary>unoidl.com.sun.star.sheet.XHeaderFooterContent</summary>
'RightPageFooterContent
''''
<summary>unoidl.com.sun.star.sheet.XHeaderFooterContent</summary>
'RightPageHeaderContent
''' <summary>System.Boolean def:False</summary>
RubyBelow
'''' <summary>System.Int16 def:0</summary>
'ScaleToPages
'''' <summary>System.Int16 def:0</summary>
'ScaleToPagesX
'''' <summary>System.Int16 def:0</summary>
'ScaleToPagesY
''' <summary>unoidl.com.sun.star.table.ShadowFormat</summary>
ShadowFormat
''' <summary>unoidl.com.sun.star.awt.Size</summary>
Size
''' <summary>System.Boolean def:False</summary>
StandardPageMode
''' <summary>unoidl.com.sun.star.text.XTextColumns</summary>
TextColumns
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
TopBorder
''' <summary>System.Int32 def:0</summary>
TopBorderDistance
''' <summary>System.Int32 def:2000</summary>
TopMargin
'''' <summary>System.Boolean def:True</summary>
'TransparentFooterBackground
'''' <summary>System.Boolean def:True</summary>
'TransparentHeaderBackground
''' <summary>unoidl.com.sun.star.container.XNameContainer</summary>
UserDefinedAttributes
''' <summary>System.Int32 def:21001</summary>
Width
''' <summary>System.Int16 def:0</summary>
WritingMode
End
Enum
''' <summary>
'''
Writer Range Property
''' </summary>
Enum
enmWriterRangePpt As Integer
''' <summary>System.Int32 def:0</summary>
BorderDistance
''' <summary>unoidl.com.sun.star.table.BorderLine def:BorderLine</summary>
BottomBorder
''' <summary>System.Int32 def:0</summary>
BottomBorderDistance
''' <summary>unoidl.com.sun.star.style.BreakType def:NONE</summary>
BreakType
''' <summary>unoidl.com.sun.star.table.XCell(ReadOnly) def:Nothing</summary>
Cell
''' <summary>System.Boolean def:False</summary>
CharAutoEscapement
''' <summary>System.Boolean def:True</summary>
CharAutoKerning
''' <summary>System.String def:0</summary>
CharAutoStyleName
''' <summary>System.Int32 def:Color [White]</summary>
CharBackColor
''' <summary>System.Boolean def:True</summary>
CharBackTransparent
''' <summary>System.Int16 def:0</summary>
CharCaseMap
''' <summary>System.Int32Color [White]</summary>
CharColor
''' <summary>System.Boolean def:False</summary>
CharCombineIsOn
''' <summary>System.String</summary>
CharCombinePrefix
''' <summary>System.String</summary>
CharCombineSuffix
''' <summary>System.Boolean def:False</summary>
CharContoured
''' <summary>System.Boolean def:False</summary>
CharCrossedOut
''' <summary>System.Int16 def:0</summary>
CharEmphasis
''' <summary>System.Int16 def:0</summary>
CharEscapement
''' <summary>System.Byte def:100</summary>
CharEscapementHeight
''' <summary>System.Boolean def:False</summary>
CharFlash
''' <summary>System.Int16 def:60</summary>
CharFontCharSet
''' <summary>System.Int16 def:60</summary>
CharFontCharSetAsian
''' <summary>System.Int16 def:60</summary>
CharFontCharSetComplex
''' <summary>System.Int16 def:3</summary>
CharFontFamily
''' <summary>System.Int16 def:6</summary>
CharFontFamilyAsian
''' <summary>System.Int16 def:6</summary>
CharFontFamilyComplex
''' <summary>System.String def:Times New Roman</summary>
CharFontName
''' <summary>System.String def:lr ožŠ</summary>
CharFontNameAsian
''' <summary>System.String def:mangal</summary>
CharFontNameComplex
''' <summary>System.Int16 def:2</summary>
CharFontPitch
''' <summary>System.Int16 def:2</summary>
CharFontPitchAsian
''' <summary>System.Int16 def:2</summary>
CharFontPitchComplex
''' <summary>System.String</summary>
CharFontStyleName
''' <summary>System.String</summary>
CharFontStyleNameAsian
''' <summary>System.String</summary>
CharFontStyleNameComplex
''' <summary>System.Single def:12</summary>
CharHeight
''' <summary>System.Single def:12</summary>
CharHeightAsian
''' <summary>System.Single def:12</summary>
CharHeightComplex
''' <summary>System.Boolean def:False</summary>
CharHidden
''' <summary>System.Int16 def:0</summary>
CharKerning
''' <summary>unoidl.com.sun.star.lang.Locale</summary>
CharLocale
''' <summary>unoidl.com.sun.star.lang.Locale</summary>
CharLocaleAsian
''' <summary>unoidl.com.sun.star.lang.Locale</summary>
CharLocaleComplex
''' <summary>System.Boolean def:True</summary>
CharNoHyphenation
''' <summary>System.Int16 def:0</summary>
CharOverline
''' <summary>System.Int32 def:Color[White]</summary>
CharOverlineColor
''' <summary>System.Boolean def:False</summary>
CharOverlineHasColor
''' <summary>unoidl.com.sun.star.awt.FontSlant def:NONE</summary>
CharPosture
''' <summary>unoidl.com.sun.star.awt.FontSlant def:NONE</summary>
CharPostureAsian
''' <summary>unoidl.com.sun.star.awt.FontSlant def:NONE</summary>
CharPostureComplex
''' <summary>System.Int16 def:0</summary>
CharRelief
''' <summary>System.Int16 def:0</summary>
CharRotation
''' <summary>System.Boolean def:False</summary>
CharRotationIsFitToLine
''' <summary>System.Int16 def:100</summary>
CharScaleWidth
''' <summary>System.Boolean def:False</summary>
CharShadowed
''' <summary>System.Int16 def:0</summary>
CharStrikeout
''' <summary>System.String</summary>
CharStyleName
''' <summary>System.String() def:Nothing</summary>
CharStyleNames
''' <summary>System.Int16 def:0</summary>
CharUnderline
''' <summary>System.Int32 def:Color[White]</summary>
CharUnderlineColor
''' <summary>System.Boolean def:False</summary>
CharUnderlineHasColor
'''
<summary>System.Single
def:100</summary>
CharWeight
''' <summary>System.Single def:100</summary>
CharWeightAsian
''' <summary>System.Single def:100</summary>
CharWeightComplex
''' <summary>System.Boolean def:False</summary>
CharWordMode
''' <summary>System.Boolean(ReadOnly) def:False</summary>
ContinueingPreviousSubTree
''' <summary>unoidl.com.sun.star.text.XDocumentIndex(ReadOnly)
def:Nothing</summary>
DocumentIndex
''' <summary>unoidl.com.sun.star.text.XDocumentIndexMark(ReadOnly)
def:Nothing</summary>
DocumentIndexMark
''' <summary>System.String</summary>
DropCapCharStyleName
''' <summary>unoidl.com.sun.star.style.DropCapFormat </summary>
DropCapFormat
''' <summary>System.Boolean def:False</summary>
DropCapWholeWord
''' <summary>unoidl.com.sun.star.text.XFootnote(ReadOnly) def:Nothing</summary>
Endnote
''' <summary>unoidl.com.sun.star.text.XFootnote(ReadOnly) def:Nothing</summary>
Footnote
''' <summary>unoidl.com.sun.star.container.XNameReplace</summary>
HyperLinkEvents
''' <summary>System.String</summary>
HyperLinkName
''' <summary>System.String</summary>
HyperLinkTarget
''' <summary>System.String</summary>
HyperLinkURL
''' <summary>System.Boolean def:False</summary>
IsSkipHiddenText
''' <summary>System.Boolean def:False</summary>
IsSkipProtectedText
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
LeftBorder
''' <summary>System.Int32 def:0</summary>
LeftBorderDistance
''' <summary>System.String</summary>
ListId
''' <summary>System.String(ReadOnly)</summary>
ListLabelString
''' <summary>System.Boolean def:False</summary>
NumberingIsNumber
''' <summary>System.Int16 def:0</summary>
NumberingLevel
''' <summary>unoidl.com.sun.star.container.XIndexReplace def:Nothing</summary>
NumberingRules
''' <summary>System.Int16 def:-1</summary>
NumberingStartValue
''' <summary>System.String</summary>
NumberingStyleName
''' <summary>System.Int16 def:0</summary>
OutlineLevel
''' <summary>System.String def:Nothing</summary>
PageDescName
''' <summary>System.Int16 def:0</summary>
PageNumberOffset
''' <summary>System.String(ReadOnly) def:Standard</summary>
PageStyleName
''' <summary>System.Int16 def:0</summary>
ParaAdjust
''' <summary>System.String def:0</summary>
ParaAutoStyleName
''' <summary>System.Int32 def:Color[White]</summary>
ParaBackColor
''' <summary>System.String</summary>
ParaBackGraphicFilter
''' <summary>unoidl.com.sun.star.style.GraphicLocation def:NONE</summary>
ParaBackGraphicLocation
''' <summary>System.String</summary>
ParaBackGraphicURL
''' <summary>System.Boolean def:True</summary>
ParaBackTransparent
''' <summary>System.Int32 def:0</summary>
ParaBottomMargin
''' <summary>System.Byte def:Nothing</summary>
ParaChapterNumberingLevel
''' <summary>System.String(ReadOnly) def:Standard</summary>
ParaConditionalStyleName
''' <summary>System.Boolean def:False</summary>
ParaExpandSingleWord
''' <summary>System.Int32 def:0</summary>
ParaFirstLineIndent
''' <summary>System.Int16 def:0</summary>
ParaHyphenationMaxHyphens
''' <summary>System.Int16 def:2</summary>
ParaHyphenationMaxLeadingChars
''' <summary>System.Int16 def:2</summary>
ParaHyphenationMaxTrailingChars
''' <summary>System.Boolean def:False</summary>
ParaIsAutoFirstLineIndent
''' <summary>System.Boolean def:True</summary>
ParaIsCharacterDistance
''' <summary>System.Boolean def:True</summary>
ParaIsConnectBorder
''' <summary>System.Boolean def:True</summary>
ParaIsForbiddenRules
''' <summary>System.Boolean def:True</summary>
ParaIsHangingPunctuation
''' <summary>System.Boolean def:False</summary>
ParaIsHyphenation
''' <summary>System.Boolean def:False</summary>
ParaIsNumberingRestart
''' <summary>System.Boolean def:False</summary>
ParaKeepTogether
''' <summary>System.Int16 def:0</summary>
ParaLastLineAdjust
''' <summary>System.Int32 def:0</summary>
ParaLeftMargin
''' <summary>System.Boolean def:True</summary>
ParaLineNumberCount
''' <summary>System.Int32 def:0</summary>
ParaLineNumberStartValue
''' <summary>unoidl.com.sun.star.style.LineSpacing</summary>
ParaLineSpacing
''' <summary>System.Byte def:0</summary>
ParaOrphans
''' <summary>System.Boolean def:False</summary>
ParaRegisterModeActive
''' <summary>System.Int32 def:0</summary>
ParaRightMargin
''' <summary>unoidl.com.sun.star.table.ShadowFormat</summary>
ParaShadowFormat
''' <summary>System.Boolean def:True</summary>
ParaSplit
''' <summary>System.String def:Standard</summary>
ParaStyleName
''' <summary>unoidl.com.sun.star.style.TabStop[]</summary>
ParaTabStops
''' <summary>System.Int32 def:0</summary>
ParaTopMargin
''' <summary>unoidl.com.sun.star.container.XNameContainer</summary>
ParaUserDefinedAttributes
''' <summary>System.Int16 def:0</summary>
ParaVertAlignment
''' <summary>System.Byte def:0</summary>
ParaWidows
''' <summary>unoidl.com.sun.star.text.XTextContent def:Nothing</summary>
ReferenceMark
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
RightBorder
''' <summary>System.Int32 def:0</summary>
RightBorderDistance
''' <summary>System.Int16 def:0</summary>
RubyAdjust
''' <summary>System.String</summary>
RubyCharStyleName
''' <summary>System.Boolean def:True</summary>
RubyIsAbove
''' <summary>System.String</summary>
RubyText
''' <summary>System.Boolean def:True</summary>
SnapToGrid
''' <summary>unoidl.com.sun.star.text.XTextField(ReadOnly) def:Nothing</summary>
TextField
''' <summary>unoidl.com.sun.star.text.XTextFrame(ReadOnly) def:Nothing</summary>
TextFrame
''' <summary>unoidl.com.sun.star.text.XTextSection(ReadOnly) def:Nothing</summary>
TextSection
''' <summary>unoidl.com.sun.star.text.XTextTable(ReadOnly) def:Nothing</summary>
TextTable
''' <summary>unoidl.com.sun.star.container.XNameContainer</summary>
TextUserDefinedAttributes
''' <summary>unoidl.com.sun.star.table.BorderLine</summary>
TopBorder
''' <summary>System.Int32 def:0</summary>
TopBorderDistance
''' <summary>System.String</summary>
UnvisitedCharStyleName
''' <summary>System.String</summary>
VisitedCharStyleName
''' <summary>System.Int16 def:4</summary>
WritingMode
End
Enum
''' <summary>
'''
Writer Table Property
''' </summary>
Enum
enmWriterTablePpt As Integer
''' <summary>unoidl.com.sun.star.text.TextContentAnchorType(ReadOnly)
def:AT_PARAGRAPH</summary>
AnchorType
''' <summary>unoidl.com.sun.star.text.TextContentAnchorType[](ReadOnly)
def:unoidl.com.sun.star.text.TextContentAnchorType[]</summary>
AnchorTypes
''' <summary>System.Int32 def:Color [White]</summary>
BackColor
''' <summary>System.String def:</summary>
BackGraphicFilter
''' <summary>unoidl.com.sun.star.style.GraphicLocation def:NONE</summary>
BackGraphicLocation
''' <summary>System.String def:</summary>
BackGraphicURL
''' <summary>System.Boolean def:True</summary>
BackTransparent
''' <summary>System.Int32 def:0</summary>
BottomMargin
''' <summary>unoidl.com.sun.star.style.BreakType def:NONE</summary>
BreakType
''' <summary>System.Boolean def:False</summary>
ChartColumnAsLabel
''' <summary>System.Boolean def:False</summary>
ChartRowAsLabel
''' <summary>System.Boolean def:True</summary>
CollapsingBorders
''' <summary>unoidl.com.sun.star.beans.PropertyValue[](ReadOnly)
def:Nothing</summary>
EndRedline
''' <summary>System.Int32 def:0</summary>
HeaderRowCount
''' <summary>System.Int16 def:6</summary>
HoriOrient
''' <summary>System.Boolean def:False</summary>
IsWidthRelative
''' <summary>System.Boolean def:False</summary>
KeepTogether
''' <summary>System.Int32 def:0</summary>
LeftMargin
''' <summary>System.String(ReadOnly) def:\1</summary>
LinkDisplayName
''' <summary>System.String def:</summary>
PageDescName
''' <summary>System.Int16 def:0</summary>
PageNumberOffset
''' <summary>System.String def:Nothing</summary>
PageStyleName
''' <summary>System.Int16 def:0</summary>
RelativeWidth
''' <summary>System.Boolean def:False</summary>
RepeatHeadline
''' <summary>System.Int32 def:0</summary>
RightMargin
''' <summary>unoidl.com.sun.star.table.ShadowFormat
def:unoidl.com.sun.star.table.ShadowFormat</summary>
ShadowFormat
''' <summary>System.Boolean def:True</summary>
Split
''' <summary>unoidl.com.sun.star.beans.PropertyValue[](ReadOnly)
def:Nothing</summary>
StartRedline
''' <summary>unoidl.com.sun.star.table.TableBorder
def:unoidl.com.sun.star.table.TableBorder</summary>
TableBorder
''' <summary>unoidl.com.sun.star.table.TableBorderDistances
def:unoidl.com.sun.star.table.TableBorderDistances</summary>
TableBorderDistances
''' <summary>System.Int16(ReadOnly) def:10000</summary>
TableColumnRelativeSum
''' <summary>unoidl.com.sun.star.text.TableColumnSeparator[]
def:unoidl.com.sun.star.text.TableColumnSeparator[]</summary>
TableColumnSeparators
''' <summary>System.String def:*Get Error</summary>
TableName
''' <summary>unoidl.com.sun.star.text.XTextSection(ReadOnly) def:Nothing</summary>
TextSection
''' <summary>unoidl.com.sun.star.text.WrapTextMode(ReadOnly) def:NONE</summary>
TextWrap
''' <summary>System.Int32 def:0</summary>
TopMargin
''' <summary>unoidl.com.sun.star.container.XNameContainer def:Uno object
proxy. OID: ebf1718;msci[0];a1c2984f17e04def96f8ce59a4be4015</summary>
UserDefinedAttributes
''' <summary>System.Int32 def:115591</summary>
Width
''' <summary>System.Int16 def:4</summary>
WritingMode
End
Enum
''' <summary>
'''
Format
''' </summary>
Enum
enmFormat As Integer
ALL =
unoidl.com.sun.star.util.NumberFormat.ALL
CURRENCY =
unoidl.com.sun.star.util.NumberFormat.CURRENCY
[DATE] =
unoidl.com.sun.star.util.NumberFormat.DATE
DATETIME =
unoidl.com.sun.star.util.NumberFormat.DATETIME
DEFINED =
unoidl.com.sun.star.util.NumberFormat.DEFINED
FRACTION =
unoidl.com.sun.star.util.NumberFormat.FRACTION
LOGICAL =
unoidl.com.sun.star.util.NumberFormat.LOGICAL
NUMBER =
unoidl.com.sun.star.util.NumberFormat.NUMBER
PERCENT =
unoidl.com.sun.star.util.NumberFormat.PERCENT
SCIENTIFIC =
unoidl.com.sun.star.util.NumberFormat.SCIENTIFIC
TEXT =
unoidl.com.sun.star.util.NumberFormat.TEXT
TIME =
unoidl.com.sun.star.util.NumberFormat.TIME
UNDEFINED =
unoidl.com.sun.star.util.NumberFormat.UNDEFINED
End
Enum
''' <summary>
'''
CellHorizontalJustify
''' </summary>
Enum
enmCellHoriJustify As Int32
BLOCK =
unoidl.com.sun.star.table.CellHoriJustify.BLOCK
CENTER =
unoidl.com.sun.star.table.CellHoriJustify.CENTER
LEFT =
unoidl.com.sun.star.table.CellHoriJustify.LEFT
REPEAT =
unoidl.com.sun.star.table.CellHoriJustify.REPEAT
RIGHT =
unoidl.com.sun.star.table.CellHoriJustify.RIGHT
STANDARD =
unoidl.com.sun.star.table.CellHoriJustify.STANDARD
End
Enum
''' <summary>
'''
CellVerticalJustify
''' </summary>
Enum
enmCellVertJustify As Int32
BOTTOM =
unoidl.com.sun.star.table.CellVertJustify.BOTTOM
CENTER =
unoidl.com.sun.star.table.CellVertJustify.CENTER
STANDARD =
unoidl.com.sun.star.table.CellVertJustify.STANDARD
TOP =
unoidl.com.sun.star.table.CellVertJustify.TOP
End
Enum
''' <summary>
'''
PageOrientation
''' </summary>
Enum
enmPageOrientation As Integer
Portrait = unoidl.com.sun.star.view.PaperOrientation.PORTRAIT
Landscape =
unoidl.com.sun.star.view.PaperOrientation.LANDSCAPE
End
Enum
''' <summary>
'''
FontStrikeout
''' </summary>
Enum
enmFontStrikeout As Integer
BOLD =
unoidl.com.sun.star.awt.FontStrikeout.BOLD
[DOUBLE] =
unoidl.com.sun.star.awt.FontStrikeout.DOUBLE
NONE =
unoidl.com.sun.star.awt.FontStrikeout.NONE
[SINGLE] =
unoidl.com.sun.star.awt.FontStrikeout.SINGLE
SLASH =
unoidl.com.sun.star.awt.FontStrikeout.SLASH
X =
unoidl.com.sun.star.awt.FontStrikeout.X
End
Enum
''' <summary>
'''
FontUnderline
''' </summary>
Enum
enmFontUnderline As Integer
BOLD =
unoidl.com.sun.star.awt.FontUnderline.BOLD
BOLDDASH =
unoidl.com.sun.star.awt.FontUnderline.BOLDDASH
BOLDDASHDOT =
unoidl.com.sun.star.awt.FontUnderline.BOLDDASHDOT
BOLDDASHDOTDOT =
unoidl.com.sun.star.awt.FontUnderline.BOLDDASHDOTDOT
BOLDDOTTED =
unoidl.com.sun.star.awt.FontUnderline.BOLDDOTTED
BOLDLONGDASH =
unoidl.com.sun.star.awt.FontUnderline.BOLDLONGDASH
BOLDWAVE =
unoidl.com.sun.star.awt.FontUnderline.BOLDWAVE
DASH =
unoidl.com.sun.star.awt.FontUnderline.DASH
DASHDOT =
unoidl.com.sun.star.awt.FontUnderline.DASHDOT
DASHDOTDOT =
unoidl.com.sun.star.awt.FontUnderline.DASHDOTDOT
DOTTED =
unoidl.com.sun.star.awt.FontUnderline.DOTTED
[DOUBLE] =
unoidl.com.sun.star.awt.FontUnderline.DOUBLE
DOUBLEWAVE =
unoidl.com.sun.star.awt.FontUnderline.DOUBLEWAVE
LONGDASH =
unoidl.com.sun.star.awt.FontUnderline.LONGDASH
NONE =
unoidl.com.sun.star.awt.FontUnderline.NONE
[SINGLE] =
unoidl.com.sun.star.awt.FontUnderline.SINGLE
SMALLWAVE =
unoidl.com.sun.star.awt.FontUnderline.SMALLWAVE
WAVE =
unoidl.com.sun.star.awt.FontUnderline.WAVE
End
Enum
''' <summary>
'''
PaperSizeName
''' </summary>
Enum
enmPaperSizeName As Integer
A5
A4
A3
B6_ISO
B5_ISO
B4_ISO
Letter
Regal
Longbond
Tabloid
B6_JIS
B5_JIS
B4_JIS
User
End
Enum
Public
Shared strPaperMMs() As
String = New String() _
{enmPaperSizeName.A5.ToString & "
148.00 210.00" _
,
enmPaperSizeName.A4.ToString & "
210.00 297.00" _
,
enmPaperSizeName.A3.ToString & "
297.00 420.00" _
,
enmPaperSizeName.B6_ISO.ToString & " 125.00 176.00" _
,
enmPaperSizeName.B5_ISO.ToString & " 176.00 250.00" _
,
enmPaperSizeName.B4_ISO.ToString & " 250.00 353.00" _
,
enmPaperSizeName.Letter.ToString & " 215.90 279.40" _
,
enmPaperSizeName.Regal.ToString & " 215.90 355.60" _
,
enmPaperSizeName.Longbond.ToString & " 215.90 330.20" _
,
enmPaperSizeName.Tabloid.ToString & " 279.40 431.80" _
,
enmPaperSizeName.B6_JIS.ToString & " 128.00 182.00" _
,
enmPaperSizeName.B5_JIS.ToString & " 182.00 257.00" _
,
enmPaperSizeName.B4_JIS.ToString & " 257.00 364.00" _
}
''' <summary>
'''
change PaperSizeName-->mmSize
''' </summary>
''' <param name="strPaperSizeName">PaperSizeName ex)A4</param>
Public
Shared Function
nfPaperSizeNameToMMSize _
(ByVal strPaperSizeName As
String _
) As SizeF
Try
For p1 As
Integer = 0 To
strPaperMMs.Length - 1
Dim strs() As
String = NStr.nfSplit(strPaperMMs(p1), "
*")
If NStr.nfCompare(strs(0),
strPaperSizeName) = 0 Then
Return New
SizeF(CSng(strs(1)), CSng(strs(2)))
End If
Next
Return Nothing
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
display all Property
''' </summary>
''' <param name="obj">Object</param>
Public
Shared Function
nfPropertyDisplay _
(ByVal obj As Object _
) As Boolean
Try
Dim ps As
unoidl.com.sun.star.beans.XPropertySet = obj
Dim psi As
unoidl.com.sun.star.beans.XPropertySetInfo = ps.getPropertySetInfo
Dim ppts() As
unoidl.com.sun.star.beans.Property = psi.getProperties
Dim lst As
New List(Of String)
For p1 As
Integer = 0 To
ppts.Length - 1
With ppts(p1)
Dim strLine As
String = .Name & "'''
<summary>" & .Type.ToString
If (.Attributes And
unoidl.com.sun.star.beans.PropertyAttribute.READONLY) <> 0 Then
strLine &= "(ReadOnly)"
End If
Dim objPV As
Object = fGetPropertyValue(ps, .Name)
If objPV Is
Nothing Then
strLine &= " def:Nothing"
ElseIf objPV.GetType Is GetType(String) AndAlso _
objPV = "*Get Error" Then
strLine &= " def:" & objPV
Else
If .Type Is
GetType(String)
OrElse _
.Type Is GetType(Int16)
OrElse _
.Type Is GetType(Int32)
OrElse _
.Type Is GetType(Boolean) OrElse _
.Type Is GetType(Single) OrElse _
.Type
Is GetType(unoidl.com.sun.star.awt.Size)
OrElse _
.Type Is GetType(unoidl.com.sun.star.awt.Rectangle)
Then
If .Type Is
GetType(Int32) AndAlso
_
.Name.Contains("Color") Then
strLine &= " def:" & NSS.nfCColor(objPV).ToString
ElseIf .Type Is
GetType(unoidl.com.sun.star.awt.Size) Then
strLine &= " def:" &
NOO.nfToDrawingSize(objPV).ToString
ElseIf .Type Is
GetType(unoidl.com.sun.star.awt.Rectangle) Then
strLine &= " def:" &
NOO.nfToDrawingRectangle(objPV).ToString
Else
strLine &= " def:" & objPV.ToString
End If
ElseIf .Type Is
GetType(String())
Then
strLine &= " def:" & NStr.nfJoin(objPV)
Else
strLine &= " def:" & objPV.ToString
End If
End If
strLine
&= "</summary>"
lst.Add(strLine)
End With
Next
lst.Sort()
Dim strDatas(lst.Count * 2 - 1) As String
For p1 As
Integer = 0 To
lst.Count - 1
Dim p2 As
Integer = lst(p1).IndexOf("'''")
strDatas(p1 * 2) = Mid(lst(p1), p2 + 1)
strDatas(p1 * 2 + 1) = Mid(lst(p1), 1, p2)
Next
NMsgBox.nfShow(NStr.nfJoin(strDatas, vbLf))
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
Private
Shared Function
fGetPropertyValue _
(ByVal ps As
unoidl.com.sun.star.beans.XPropertySet _
, ByVal strName As String _
) As Object
Try
Return ps.getPropertyValue(strName).Value
Catch ex As Exception
NSS.nfDW(strName, "fGetPropertyValue error")
Return "*Get Error"
End Try
End
Function
''' <summary>
'''
PropertyValueCopy
''' </summary>
''' <param name="xmpsFrom">XMultiPropertySet</param>
''' <param name="xmpsTo">XMultiPropertySet</param>
Public
Shared Function
nfPropertyValueCopy _
(ByVal xmpsFrom As
unoidl.com.sun.star.beans.XMultiPropertySet _
, ByVal xmpsTo As
unoidl.com.sun.star.beans.XMultiPropertySet _
) As Boolean
Try
Dim ppts() As
unoidl.com.sun.star.beans.Property = _
xmpsFrom.getPropertySetInfo.getProperties
Dim lst As
New List(Of String)
For p2 As
Integer = 0 To
ppts.Length - 1
If (ppts(p2).Attributes And
unoidl.com.sun.star.beans.PropertyAttribute.READONLY) = 0 Then
lst.Add(ppts(p2).Name)
End If
Next
Dim pvs() As
uno.Any = xmpsFrom.getPropertyValues(lst.ToArray)
xmpsTo.setPropertyValues(lst.ToArray, pvs)
'changed to CellHoriJustify=1(LEFT)
Dim pvs2() As
uno.Any = xmpsTo.getPropertyValues(lst.ToArray)
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Size-->awtSize
''' </summary>
''' <param name="siz">Size</param>
Public
Shared Function
nfToawtSize _
(ByVal siz As Size _
) As unoidl.com.sun.star.awt.Size
Try
If siz = Nothing
Then
siz = New Size(0, 0)
End If
Dim sizawt As
unoidl.com.sun.star.awt.Size = New
unoidl.com.sun.star.awt.Size
sizawt.Height = siz.Height
sizawt.Width = siz.Width
Return sizawt
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
awt.Size-->DrawingSize
''' </summary>
''' <param name="sizawt"></param>
Public
Shared Function
nfToDrawingSize _
(ByVal sizawt As
unoidl.com.sun.star.awt.Size _
) As Size
Try
Dim sizDrawing As
Size = Nothing
sizDrawing.Height = sizawt.Height
sizDrawing.Width = sizawt.Width
Return sizDrawing
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Rectangle-->awtRectangle
''' </summary>
''' <param name="rct">Rectangle</param>
Public
Shared Function
nfToawtRectangle _
(ByVal rct As
Rectangle _
) As unoidl.com.sun.star.awt.Rectangle
Try
If rct = Nothing
Then
rct = New Rectangle(0, 0, 0, 0)
End If
Dim rctawt As
New unoidl.com.sun.star.awt.Rectangle
rctawt.X = rct.X
rctawt.Y = rct.Y
rctawt.Height = rct.Height
rctawt.Width = rct.Width
Return rctawt
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End
Try
End
Function
''' <summary>
'''
awt.Rectangle-->DrawingRectangle
''' </summary>
''' <param name="rctawt"></param>
Public
Shared Function
nfToDrawingRectangle _
(ByVal rctawt As
unoidl.com.sun.star.awt.Rectangle _
) As Rectangle
Try
Dim rctDrawing As
Rectangle = Nothing
rctDrawing.X = rctawt.X
rctDrawing.Y = rctawt.Y
rctDrawing.Height = rctawt.Height
rctDrawing.Width = rctawt.Width
Return rctDrawing
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Point-->awtPoint
''' </summary>
''' <param name="pnt">Point</param>
Public
Shared Function
nfToawtPoint _
(ByVal
pnt As Point _
) As unoidl.com.sun.star.awt.Point
Try
If pnt = Nothing
Then
pnt = New Point(0, 0)
End If
Dim pntawt As
unoidl.com.sun.star.awt.Point = _
New unoidl.com.sun.star.awt.Point
pntawt.X = pnt.X
pntawt.Y = pnt.Y
Return pntawt
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
awt.Point-->Point
''' </summary>
''' <param name="pntawt">Point</param>
Public
Shared Function
nfToDrawingPoint _
(ByVal pntawt As
unoidl.com.sun.star.awt.Point _
) As Point
Try
Dim pntDrawing As
Point = Nothing
pntDrawing.X = pntawt.X
pntDrawing.Y = pntawt.Y
Return pntDrawing
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Property
''' </summary>
''' <param name="obj">Object Doc,Xrange,XCursor</param>
''' <param name="strID">ID</param>
<Browsable(False)> _
Public
Shared Property
_objProperty _
(ByVal obj As Object _
, ByVal strID As String _
) As Object
Get
Dim ps As
unoidl.com.sun.star.beans.XPropertySet = obj
If
ps.getPropertySetInfo.hasPropertyByName(strID) = True
Then
Return ps.getPropertyValue(strID).Value
End If
NError.nfRaise(strID, "strPropertyName error")
Return Nothing
End Get
Set(ByVal value As Object)
Try
Dim ps As
unoidl.com.sun.star.beans.XPropertySet = obj
If
ps.getPropertySetInfo.hasPropertyByName(strID) = True
Then
ps.setPropertyValue(strID, New
uno.Any(value.GetType, value))
Else
NError.nfRaise(strID, "strID error")
End If
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Set
End
Property
''' <summary>
''' Font
Property
''' </summary>
''' <param name="obj">Object Doc,Xrange,XCursor</param>
<Browsable(False)> _
Public
Shared Property
_Font _
(ByVal obj As Object _
) As Font
Get
Dim strFontName As
String = _objProperty(obj, "CharFontNameAsian")
If strFontName = "" Then
Return Nothing
End If
Dim sngHeight As
Single = _objProperty(obj,
"CharHeight")
Dim fs As
New FontStyle
If _objProperty(obj,
"CharPosture") = unoidl.com.sun.star.awt.FontSlant.ITALIC Then
fs = fs Or FontStyle.Italic
End If
If _objProperty(obj,
"CharWeight") > 100 Then
fs = fs Or FontStyle.Bold
End If
If _objProperty(obj,
"CharStrikeout") <> 0 Then
fs = fs Or FontStyle.Strikeout
End If
If _objProperty(obj,
"CharUnderline") <> 0 Then
fs = fs Or FontStyle.Underline
End If
Return New
Font(strFontName, sngHeight, fs)
End Get
Set(ByVal value As Font)
Try
_objProperty(obj, "CharFontNameAsian") = value.Name
_objProperty(obj, "CharFontName") = value.Name
_objProperty(obj, "CharHeight") = value.SizeInPoints
If (value.Style And
FontStyle.Strikeout) <> 0 Then
_objProperty(obj, "CharStrikeout") = _
NSS.nfCInt(enmFontStrikeout.SINGLE)
Else
_objProperty(obj, "CharStrikeout") = 0
End If
If (value.Style And
FontStyle.Underline) <> 0 Then
_objProperty(obj, "CharUnderline") = _
NSS.nfCInt(enmFontStrikeout.SINGLE)
Else
_objProperty(obj, "CharUnderline") = 0
End If
If (value.Style And
FontStyle.Bold) <> 0 Then
_objProperty(obj, "CharWeight") = 200
_objProperty(obj, "CharWeightAsian") = 200
Else
_objProperty(obj, "CharWeight") = 100
_objProperty(obj, "CharWeightAsian") = 100
End If
If (value.Style And
FontStyle.Italic) <> 0 Then
_objProperty(obj, "CharPosture") = _
unoidl.com.sun.star.awt.FontSlant.ITALIC
_objProperty(obj, "CharPostureAsian") = _
unoidl.com.sun.star.awt.FontSlant.ITALIC
Else
_objProperty(obj, "CharPosture") = 0
_objProperty(obj, "CharPostureAsian") = 0
End If
Catch ex As
Exception
NError.nfShow(ex,
Err.Number)
End Try
End Set
End
Property
''' <summary>
'''
BorderLine
''' </summary>
Public
Class g_ctypBorderLine
''' <summary>New</summary>
''' <param
name="BorderLineIndex">enmBorderLineIndex</param>
''' <param
name="InnerLineWidth">usually set
to OuterLine 1pt=35 2,16,35,60</param>
''' <param
name="OuterLineWidth">1pt=35 2,16,35,60</param>
''' <param
name="LineDistance"></param>
''' <param
name="intColor">ColorRGB</param>
Public Sub New _
(Optional ByVal
BorderLineIndex As NOffice.enmBorderLineIndex =
0 _
, Optional ByVal
InnerLineWidth As Integer
= 0 _
, Optional ByVal
OuterLineWidth As Integer
= 0 _
, Optional ByVal
LineDistance As Integer
= 0 _
, Optional ByVal
intColor As Integer
= 0 _
)
Try
bli = BorderLineIndex
intInnerLineWidth = InnerLineWidth
intOuterLineWidth = OuterLineWidth
intLineDistance = LineDistance
clr = Color.FromArgb(intColor)
Catch ex As
Exception
NError.nfShow(ex, Err.Number)
End Try
End Sub
''' <summary>enmBorderLineIndex</summary>
Public bli As
NOffice.enmBorderLineIndex
''' <summary>1pt=35 2,16,35,60</summary>
Public intInnerLineWidth As
Integer
''' <summary>usually set to OuterLine 1pt=35 2,16,35,60</summary>
Public intOuterLineWidth As
Integer
Public intLineDistance As
Integer
Public clr As Color
End
Class
''' <summary>
'''
GetBorderLine
''' </summary>
''' <param name="tb">unoidl.com.sun.star.table.TableBorder</param>
''' <param name="bli">NOffice.enmBorderLineIndex</param>
''' <param name="lstBL">List(Of g_ctypBorderLine)</param>
''' <param name="objRange">Range</param>
Public
Shared Function
nfGetBorderLine _
(ByVal tb As
unoidl.com.sun.star.table.TableBorder _
, ByVal bli As
NOffice.enmBorderLineIndex _
, ByVal lstBL As List(Of g_ctypBorderLine) _
, ByVal objRange As Object _
) As g_ctypBorderLine
Try
Dim bl As
unoidl.com.sun.star.table.BorderLine = Nothing
If bli =
NOffice.enmBorderLineIndex.EdgeLeft AndAlso _
tb.IsLeftLineValid = True Then
bl
= tb.LeftLine
ElseIf bli =
NOffice.enmBorderLineIndex.EdgeTop AndAlso _
tb.IsTopLineValid = True Then
bl = tb.TopLine
ElseIf bli =
NOffice.enmBorderLineIndex.EdgeRight AndAlso _
tb.IsRightLineValid = True Then
bl = tb.RightLine
ElseIf bli =
NOffice.enmBorderLineIndex.EdgeBottom AndAlso _
tb.IsBottomLineValid = True Then
bl = tb.BottomLine
ElseIf bli =
NOffice.enmBorderLineIndex.InsideHorizontal AndAlso
_
tb.IsHorizontalLineValid = True Then
bl = tb.HorizontalLine
ElseIf bli =
NOffice.enmBorderLineIndex.InsideVertical AndAlso
_
tb.IsVerticalLineValid = True Then
bl = tb.VerticalLine
ElseIf objRange IsNot
Nothing AndAlso
_
bli = NOffice.enmBorderLineIndex.DiagonalDown Then
bl = _objProperty(objRange, "DiagonalTLBR")
ElseIf objRange IsNot
Nothing AndAlso
_
bli = NOffice.enmBorderLineIndex.DiagonalUp Then
bl = _objProperty(objRange, "DiagonalBLTR")
End If
If bl IsNot
Nothing AndAlso
_
(bl.InnerLineWidth <> 0 OrElse _
bl.OuterLineWidth <> 0) Then
Dim clsBL As
g_ctypBorderLine = _
New g_ctypBorderLine(bli _
, bl.InnerLineWidth _
, bl.OuterLineWidth _
, bl.LineDistance _
, bl.Color _
)
lstBL.Add(clsBL)
Return clsBL
End If
Return Nothing
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
GetTableBorderLines
''' </summary>
''' <param name="tb">unoidl.com.sun.star.table.TableBorder</param>
Public
Shared Function
nfGetTableBorderLines _
(ByVal tb As
unoidl.com.sun.star.table.TableBorder _
, ByVal
objRange As Object
_
) As g_ctypBorderLine()
Try
Dim lstBL As
New List(Of
NOO.g_ctypBorderLine)
Dim clsLeft As
NOO.g_ctypBorderLine = _
NOO.nfGetBorderLine(tb, NOffice.enmBorderLineIndex.EdgeLeft, lstBL, objRange)
Dim clsTop As
NOO.g_ctypBorderLine = _
NOO.nfGetBorderLine(tb, NOffice.enmBorderLineIndex.EdgeTop, lstBL,
objRange)
Dim clsRight As
NOO.g_ctypBorderLine = _
NOO.nfGetBorderLine(tb, NOffice.enmBorderLineIndex.EdgeRight, lstBL,
objRange)
Dim clsBottom As
NOO.g_ctypBorderLine = _
NOO.nfGetBorderLine(tb, NOffice.enmBorderLineIndex.EdgeBottom, lstBL,
objRange)
'Summarize Left & Right
If clsLeft IsNot
Nothing AndAlso
_
clsRight
IsNot Nothing AndAlso _
clsLeft.clr.Equals(clsRight.clr) AndAlso
_
clsLeft.intInnerLineWidth = clsRight.intInnerLineWidth AndAlso _
clsLeft.intOuterLineWidth = clsRight.intOuterLineWidth AndAlso _
clsLeft.intLineDistance
= clsRight.intLineDistance Then
For p1 As
Integer = 0 To
lstBL.Count - 1
If lstBL(p1).bli =
NOffice.enmBorderLineIndex.EdgeLeft Then
lstBL(p1).bli = NOffice.enmBorderLineIndex.LeftRight
clsRight = Nothing
ElseIf lstBL(p1).bli =
NOffice.enmBorderLineIndex.EdgeRight Then
lstBL.RemoveAt(p1)
Exit For
End If
Next
End If
'Summarize Top & Bottom
If clsTop IsNot
Nothing AndAlso
_
clsBottom IsNot Nothing
AndAlso _
clsTop.clr.Equals(clsBottom.clr) AndAlso
_
clsTop.intInnerLineWidth = clsBottom.intInnerLineWidth AndAlso _
clsTop.intOuterLineWidth = clsBottom.intOuterLineWidth AndAlso _
clsTop.intLineDistance = clsBottom.intLineDistance Then
For p1 As
Integer = 0 To
lstBL.Count - 1
If lstBL(p1).bli =
NOffice.enmBorderLineIndex.EdgeTop Then
lstBL(p1).bli = NOffice.enmBorderLineIndex.TopBottom
clsBottom = Nothing
ElseIf lstBL(p1).bli =
NOffice.enmBorderLineIndex.EdgeBottom Then
lstBL.RemoveAt(p1)
Exit For
End If
Next
End If
'Summarize Around
If clsLeft IsNot
Nothing AndAlso
_
clsLeft.bli = NOffice.enmBorderLineIndex.LeftRight AndAlso _
clsTop IsNot Nothing
AndAlso _
clsTop.bli = NOffice.enmBorderLineIndex.TopBottom AndAlso _
clsLeft.clr.Equals(clsTop.clr) AndAlso _
clsLeft.intInnerLineWidth = clsTop.intInnerLineWidth AndAlso _
clsLeft.intOuterLineWidth = clsTop.intOuterLineWidth AndAlso _
clsLeft.intLineDistance = clsTop.intLineDistance Then
For p1 As
Integer = 0 To
lstBL.Count - 1
If lstBL(p1).bli =
NOffice.enmBorderLineIndex.LeftRight Then
lstBL(p1).bli = NOffice.enmBorderLineIndex.Around
clsTop = Nothing
ElseIf lstBL(p1).bli =
NOffice.enmBorderLineIndex.TopBottom Then
lstBL.RemoveAt(p1)
Exit For
End If
Next
End If
'Summarize InsideHorizontal &
InsideVertical
Dim clsInsideHorizontal As NOO.g_ctypBorderLine = _
nfGetBorderLine(tb, NOffice.enmBorderLineIndex.InsideHorizontal, lstBL,
objRange)
Dim clsInsideVertical As NOO.g_ctypBorderLine = _
nfGetBorderLine(tb, NOffice.enmBorderLineIndex.InsideVertical, lstBL,
objRange)
If clsInsideHorizontal IsNot Nothing AndAlso _
clsInsideVertical IsNot Nothing AndAlso _
clsInsideHorizontal.clr.Equals(clsInsideVertical.clr) AndAlso _
clsInsideHorizontal.intInnerLineWidth =
clsInsideVertical.intInnerLineWidth AndAlso _
clsInsideHorizontal.intOuterLineWidth =
clsInsideVertical.intOuterLineWidth AndAlso _
clsInsideHorizontal.intLineDistance = clsInsideVertical.intLineDistance Then
For p1 As
Integer = 0 To
lstBL.Count - 1
If lstBL(p1).bli =
NOffice.enmBorderLineIndex.InsideHorizontal Then
lstBL(p1).bli = NOffice.enmBorderLineIndex.InsideBoth
clsBottom = Nothing
ElseIf lstBL(p1).bli =
NOffice.enmBorderLineIndex.InsideVertical Then
lstBL.RemoveAt(p1)
Exit For
End If
Next
End If
'Summarize
DiagonalDown & DiagonalUp
Dim clsDiagonalDown As NOO.g_ctypBorderLine = _
nfGetBorderLine(tb, NOffice.enmBorderLineIndex.DiagonalDown, lstBL,
objRange)
Dim clsDiagonalUp As NOO.g_ctypBorderLine = _
nfGetBorderLine(tb, NOffice.enmBorderLineIndex.DiagonalUp, lstBL,
objRange)
Return lstBL.ToArray
If clsDiagonalDown IsNot Nothing AndAlso _
clsDiagonalUp IsNot Nothing AndAlso _
NReflection.nfÎĆě(clsDiagonalDown,
":", clsDiagonalUp) = True Then
For p1 As
Integer = 0 To
lstBL.Count - 1
If lstBL(p1).bli =
NOffice.enmBorderLineIndex.DiagonalDown Then
lstBL(p1).bli = NOffice.enmBorderLineIndex.DiagonalBoth
clsBottom = Nothing
ElseIf lstBL(p1).bli =
NOffice.enmBorderLineIndex.DiagonalUp Then
lstBL.RemoveAt(p1)
Exit For
End If
Next
End If
Return lstBL.ToArray
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
SetTableBorderLines
''' </summary>
''' <param name="objRange">Range</param>
''' <param name="clsBorderLines">clsBorderLines</param>
Public
Shared Function
nfSetTableBorderLines _
(ByVal objRange As Object _
, ByVal clsBorderLines() As
g_ctypBorderLine _
) As Boolean
Try
Dim tb As
New unoidl.com.sun.star.table.TableBorder
For p1 As Integer = 0 To clsBorderLines.Length - 1
Dim clsBL As
NOO.g_ctypBorderLine = clsBorderLines(p1)
Dim bl As
New unoidl.com.sun.star.table.BorderLine
bl.InnerLineWidth = clsBL.intInnerLineWidth
bl.OuterLineWidth = clsBL.intOuterLineWidth
bl.LineDistance = clsBL.intLineDistance
bl.Color = clsBL.clr.ToArgb
If clsBL.bli =
NOffice.enmBorderLineIndex.Around Then
tb.LeftLine = bl : tb.IsLeftLineValid = True
tb.TopLine = bl : tb.IsTopLineValid = True
tb.RightLine = bl : tb.IsRightLineValid = True
tb.BottomLine = bl : tb.IsBottomLineValid = True
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.LeftRight Then
tb.LeftLine = bl : tb.IsLeftLineValid = True
tb.RightLine = bl : tb.IsRightLineValid = True
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.TopBottom Then
tb.TopLine = bl : tb.IsTopLineValid = True
tb.BottomLine
= bl : tb.IsBottomLineValid = True
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.EdgeLeft Then
tb.LeftLine = bl : tb.IsLeftLineValid = True
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.EdgeTop Then
tb.TopLine = bl : tb.IsTopLineValid = True
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.EdgeRight Then
tb.RightLine = bl : tb.IsRightLineValid = True
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.EdgeBottom Then
tb.BottomLine = bl : tb.IsBottomLineValid = True
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.InsideBoth Then
tb.HorizontalLine = bl : tb.IsHorizontalLineValid = True
tb.VerticalLine = bl : tb.IsVerticalLineValid = True
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.InsideHorizontal Then
tb.HorizontalLine = bl : tb.IsHorizontalLineValid = True
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.InsideVertical Then
tb.VerticalLine = bl : tb.IsVerticalLineValid = True
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.DiagonalBoth Then
_objProperty(objRange, "DiagonalBLTR") = bl
_objProperty(objRange, "DiagonalTLBR") = bl
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.DiagonalUp Then
_objProperty(objRange, "DiagonalBLTR") = bl
ElseIf clsBL.bli =
NOffice.enmBorderLineIndex.DiagonalDown Then
_objProperty(objRange, "DiagonalTLBR") = bl
Else
NError.nfRaise(clsBL.bli, "clsBL.bli error")
End If
Next
_objProperty(objRange, "TableBorder") = tb
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
End Class
9.Excel,OpenOffice Common
9-1.NOffice
Imports System.Drawing
Imports System.Windows.Forms
Imports
System.Runtime.InteropServices
Imports System.Text
Imports Microsoft.Office.Interop
''' <summary>
''' Office(Excel,Calc) Shared
''' </summary>
Public Class NOffice
Public
Shared chrOfficeSheetNameUnusableCharacters() As Char = _
":\/?*[]¤".ToCharArray
''' <summary>
''' get
MSOfficeApplicationPath able to
Install check
''' cnat
check just after Installed, so should use excel once
''' </summary>
''' <param name="strApplicationName">ex)excel.application</param>
Public
Shared Function
nfGetMSOfficeApplicationPath _
(ByVal strApplicationName As
String _
) As String
Try
Dim strCLSID As
String = _
NRegistry.nfGetValue(NRegistry.g_enmHKey.HKEY_LOCAL_MACHINE _
, "Software\Classes\" & strApplicationName &
"\CLSID" _
,
"" _
, "" _
)
Dim strInstallPath As String = _
NRegistry.nfGetValue(NRegistry.g_enmHKey.HKEY_LOCAL_MACHINE _
, "Software\Classes\CLSID\" & strCLSID &
"\LocalServer32" _
, "" _
, "" _
)
If strInstallPath = "" Then
Return ""
Else
Return NIO.nfGetFullPath(strInstallPath)
End If
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' get
OpenOfficeApplicationPath able to
Install check
''' </summary>
Public
Shared Function
nfGetOpenOfficeApplicationPath _
( _
) As String
Try
Dim strInstallPath As String =
""
If NIO.nfFileExists("\Program
Files\OpenOffice.org 3\Program\soffice.exe") = "" Then
strInstallPath = "\Program Files\OpenOffice.org
3\Program\soffice.exe"
ElseIf NIO.nfFileExists("\Program Files (x86)\OpenOffice.org
3\Program\soffice.exe") = "" Then
strInstallPath = "\Program Files (x86)\OpenOffice.org
3\Program\soffice.exe"
ElseIf NIO.nfFileExists("\Program Files\OpenOffice.org
4\Program\soffice.exe") = "" Then
strInstallPath = "\Program Files\OpenOffice.org
4\Program\soffice.exe"
ElseIf NIO.nfFileExists("\Program Files (x86)\OpenOffice.org 4\Program\soffice.exe")
= "" Then
strInstallPath = "\Program Files (x86)\OpenOffice.org
4\Program\soffice.exe"
End If
If strInstallPath = "" Then
Return ""
Else
Return NIO.nfGetFullPath(strInstallPath)
End If
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' get
ExcelVersion
''' </summary>
Public
Shared Function
nfGetExcelVersion _
( _
) As String
Try
If
nfGetMSOfficeApplicationPath("excel.application") <>
"" Then
Dim nexl As
New nNExcel
Dim strVersion As
String = nexl._strVersion
nexl.nfDispose()
Return strVersion
End If
Return ""
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return False
End Try
End
Function
''' <summary>
''' get
CalcVersion
''' </summary>
Public
Shared Function
nfGetCalcVersion _
( _
) As String
Try
If nfIsOpenOfficeInstalled() = True Then
Dim ncalc As
New nNCalc
Dim strVersion As
String = ncalc._strVersion
ncalc = Nothing
Return strVersion
End If
Return ""
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return False
End Try
End
Function
''' <summary>
'''
OpenOfficeInstalled check
''' </summary>
Public
Shared Function
nfIsOpenOfficeInstalled _
( _
) As Boolean
Try
Dim bln As
Boolean =
NSS.nfInstallCheck("OpenOffice.org")
'If bln = False Then
'
'bln = NSS.nfInstallCheck("OOo-dev")
'
bln = NSS.nfInstallCheck("LibreOffice")
'End If
Return bln
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return False
End Try
End
Function
''' <summary>
''' get
Filter
''' </summary>
''' <param name="blnExcelCalc">true=ExcelCalc false=Word,Writer</param>
Public
Shared Function
nfGetFilter _
(ByVal blnExcelCalc As
Boolean _
) As String
Try
Dim strFilter1 As
String = ""
Dim strFilter2 As
String = ""
If nfIsOpenOfficeInstalled() = True Then
If blnExcelCalc = True
Then
strFilter1 = "Calc(*.ods)"
strFilter2 = "*.ods"
Else
strFilter1 = "Writer(*.odt)"
strFilter2 = "*.odt"
End If
If nfIsAdobeReaderInstalled() = True Then
strFilter1 &= "PDF(*.pdf)"
strFilter2 &= ";*.pdf"
End If
End If
If
nfGetMSOfficeApplicationPath("excel.application") <>
"" Then
If strFilter1 <> "" Then
strFilter1 &= ","
strFilter2 &= ";"
End If
If blnExcelCalc = True Then
strFilter1 &= "Excel(*.xls)"
strFilter2 &= "*.xls"
Else
strFilter1 &= "Word(*.doc)"
strFilter2 &= "*.doc"
End If
End If
If strFilter1 = "" Then
Return ""
Else
Return strFilter1 & "|"
& strFilter2
End If
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
AdobeReaderInstalled check
''' </summary>
Public
Shared Function
nfIsAdobeReaderInstalled _
( _
) As Boolean
Try
Return NSS.nfInstallCheck("Adobe
Reader")
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return False
End Try
End
Function
''' <summary>
'''
CheckSheetNameIntegrity
''' </summary>
''' <param name="strSheetName">SheetName</param>
Public
Shared Function
nfCheckSheetNameIntegrity _
(ByVal strSheetName As
String _
) As String
Try
If strSheetName = "" Then
Return "*SheetName error"
End If
If strSheetName.Length > 31 Then
Return "*SheetName over 31 charas
error"
End If
If
strSheetName.IndexOfAny(chrOfficeSheetNameUnusableCharacters) <> -1 Then
Return "*SheetName Next Character
is unusable " _
& chrOfficeSheetNameUnusableCharacters.ToString
End If
Return ""
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>A1-->point
change format
'''
[return]string Point
''' </summary>
'''
strRangeName
''' <param name="blnOther">false=only An type true=usable xxxx</param>
''' <param name="intMaxColumn">MaxColumn</param>
''' <param name="intMaxRow">MaxRow</param>
Public
Shared Function
nfAnToPoint _
(ByVal strRangeName As
String _
, ByVal blnOther As Boolean _
, ByVal intMaxColumn As
Integer _
, ByVal intMaxRow As Integer _
) As String
Try
Dim pnt As
Point
'''''Ann
If IsNumeric(Mid(strRangeName, 2)) Then
pnt.X = nfColumnToNO(Mid(strRangeName, 1, 1))
pnt.Y = Mid(strRangeName, 2)
'''''IVnn
ElseIf IsNumeric(Mid(strRangeName, 3)) Then
pnt.X = nfColumnToNO(Mid(strRangeName, 1, 2))
pnt.Y
= Mid(strRangeName, 3)
'''''XFDnn
ElseIf IsNumeric(Mid(strRangeName, 4)) Then
pnt.X = nfColumnToNO(Mid(strRangeName, 1, 3))
pnt.Y = Mid(strRangeName, 4)
'''''Kingaku
If pnt.X = 0 OrElse
_
pnt.Y = 0 Then
If blnOther = False
Then
Return "*RangeName format error
" & strRangeName
Else
pnt.X = -2
pnt.Y = -2
Return pnt.ToString
End If
End If
'''''Kingaku
Else
If blnOther = False
Then
Return "*RangeName format error
" & strRangeName
Else
pnt.X = -2
pnt.Y = -2
Return pnt.ToString
End If
End If
If pnt.X < 1 OrElse
_
pnt.Y < 1 Then
Return "*RangeName format error
" & strRangeName
End If
If pnt.X > intMaxColumn Then
Return "*Column range error " &
strRangeName
End If
If pnt.Y > intMaxRow Then
Return "*Row range error "
& strRangeName
End If
Return pnt.ToString
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>Cell(row,column)-->point
format change
'''
[return]string Point
''' </summary>
''' <param name="intMaxColumn">MaxColumn</param>
''' <param name="intMaxRow">MaxRow</param>
Public
Shared Function
nfCellToPoint _
(ByVal strItem As String _
, ByVal intMaxColumn As
Integer _
, ByVal intMaxRow As Integer _
) As String
Try
Dim pnt As
Point
Dim p1 As
Integer = strItem.IndexOf(","c)
If p1 = -1 Then
Return "*Item format error "
& strItem
End If
pnt.Y = NSS.nfCInt(Mid(strItem, 1, p1))
pnt.X = NSS.nfCInt(Mid(strItem, p1 + 2))
If pnt.X < 1 OrElse
_
pnt.Y < 1 Then
Return "*Item format error "
& strItem
End If
If pnt.X > intMaxColumn Then
Return "*Column range error "
& strItem
End If
If pnt.Y > intMaxRow Then
Return "*Row range error "
& strItem
End If
Return pnt.ToString
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>RnCn-->point
format change
'''
[return]string Point
''' </summary>
''' <param name="intMaxColumn">MaxColumn</param>
''' <param name="intMaxRow">MaxRow</param>
Public
Shared Function
nfRnCnToPoint _
(ByVal strItem As String _
, ByVal intMaxColumn As
Integer _
, ByVal intMaxRow As Integer _
) As String
Try
Dim pnt As
Point
Dim strItemUpper As String = strItem.ToUpper
If Mid(strItemUpper, 1, 1) =
"R" AndAlso _
NStr.nfInspectCount(strItemUpper, "C") = 1 Then
Dim p1 As
Integer = strItemUpper.IndexOf("C"c)
pnt.Y = Mid(Mid(strItemUpper, 1, p1), 2).Trim
pnt.X = Mid(strItemUpper, p1 + 2).Trim
End If
If pnt.X < 1 OrElse
_
pnt.Y < 1 Then
Return "*Item format error "
& strItem
End If
If pnt.X > intMaxColumn Then
Return "*Column range error "
& strItem
End If
If pnt.Y > intMaxRow Then
Return "*Row range error "
& strItem
End If
Return pnt.ToString
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>Column-->NO
'''
[return]NO Error=0
'''
[exp]A-->1
''' </summary>
''' <param name="strColumn">column</param>
Public
Shared Function
nfColumnToNO _
(ByVal strColumn As String _
) As Integer
Try
If strColumn = "" OrElse _
strColumn.Length > 3 Then
Return 0
End If
Dim str As
String = strColumn.ToUpper
Dim chr1 As
Char = Mid(str, 1, 1)
Dim chr2 As
Char = Mid(str, 2, 1)
Dim chr3 As
Char = Mid(str, 3, 1)
Dim int1 As
Integer = 0
''''''A
If chr2 = Nothing
Then
If chr1 >= "A"c AndAlso _
chr1 <= "Z"c Then
int1 = AscW(chr1) - 64
Else
Return 0
End If
''''''''BZ
ElseIf chr3 = Nothing
Then
If chr1 >= "A"c AndAlso _
chr1 <= "I"c Then
int1 = (AscW(chr1) - 64) * 26
If chr2 >= "A"c AndAlso _
chr2 <= "Z"c Then
int1 += AscW(chr2) - 64
Else
Return 0
End If
Else
Return 0
End If
Else
If chr1 >= "A"c AndAlso _
chr1 <= "I"c Then
int1 = (AscW(chr1) - 64) * 26 * 26
If chr2 >= "A"c AndAlso _
chr2 <= "Z"c Then
int1 += (AscW(chr2) - 64) * 26
If chr3 >= "A"c AndAlso _
chr3 <= "Z"c Then
int1 += AscW(chr2) - 64
Else
Return 0
End If
Else
Return 0
End If
Else
Return 0
End If
End If
Return int1
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>NO--->Column
'''
[return]Column Error=""
'''
[exp]1-->A
''' </summary>
''' <param name="intNO">NO</param>
Public
Shared Function
nfNOToColumn _
(ByVal intNO As Integer _
) As String
Try
If intNO < 1 Then
Return ""
End If
Dim strData As
String = ""
Do
Dim intQuot As
Integer = intNO \ 26
Dim intRemain As
Integer = intNO Mod
26
If intRemain = 0 Then
intQuot -= 1
intRemain += 26
End If
strData = ChrW(intRemain + 64) & strData
If intQuot = 0 Then
Exit Do
End If
intNO = intQuot
Loop
Return strData
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' Inch
PaperSizes
''' </summary>
Public
Shared strPaperInchs() As
String = New String() _
{"10x14
10.000 14.000" _
, "11x17
11.000 17.000" _
, "A3
11.692 16.535" _
, "A4
8.267 11.692" _
, "A4Small
8.267 11.692" _
, "A5
5.826 8.267" _
, "B4
9.842 13.937" _
, "B5
6.929 9.842" _
, "Csheet
17.000 22.000" _
, "Dsheet
22.000 34.000" _
, "Envelope9
3.875 8.875" _
,
"Envelope10
4.125 9.500" _
,
"Envelope11
4.500 10.375" _
,
"Envelope12
4.500 11.000" _
,
"Envelope14
5.000 11.500" _
,
"EnvelopeB4
9.842 13.937" _
,
"EnvelopeB5
6.929 9.842" _
,
"EnvelopeB6
4.921 6.929" _
,
"EnvelopeC3
12.755 18.031" _
,
"EnvelopeC4
9.015 12.755" _
,
"EnvelopeC5
6.378 9.015" _
,
"EnvelopeC6
4.488 6.378" _
,
"EnvelopeC65
4.488 9.015" _
,
"EnvelopeDL 4.330 8.661" _
,
"EnvelopeItaly 4.330 9.055" _
,
"EnvelopeMonarch
3.875 7.500" _
,
"EnvelopePersonal
3.625 6.500" _
, "Esheet
34.000 44.000" _
, "Executive
7.500 10.500" _
,
"FanfoldLegalGerman 8.500 13.000" _
,
"FanfoldStdGerman 8.500
13.000" _
, "FanfoldUS
14.875 11.000" _
, "Folio
8.500 13.000" _
, "Ledger
17.000 11.000" _
, "Legal
8.500 14.000" _
, "Letter 8.500
11.000" _
,
"LetterSmall
8.500 11.000" _
, "Note
8.500 11.000" _
, "Quarto
8.464 10.826" _
, "Statement
5.500 8.500" _
, "Tabloid
11.000 17.000" _
, "User 0.000 0.000" _
}
''' <summary>
'''
PaperSizeName-->InchSize
''' </summary>
''' <param name="strPaperSizeName">PaperSizeName ex)A4</param>
Public
Shared Function
nfPaperSizeNameToInchSize _
(ByVal strPaperSizeName As
String _
) As SizeF
Try
For p1 As
Integer = 0 To
strPaperInchs.Length - 1
Dim strs() As
String = NStr.nfSplit(strPaperInchs(p1), "
*")
If NStr.nfCompare(strs(0),
strPaperSizeName) = 0 Then
Return New
SizeF(CSng(strs(1)), CSng(strs(2)))
End If
Next
Return Nothing
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
PixelToCharacters
'''
[exp]Pixel-->Excel standard character num
''' </summary>
''' <param name="intPixel">Pixel</param>
Public
Shared Function
nfPixelToCharacters _
(ByVal intPixel As Integer _
, ByVal fnt As Font _
) As Double
Try
Dim sizCharPixel As SizeF =
NFont.nfGetCharcterSize(fnt)
Dim dbl1CharPoint As Double = _
sizCharPixel.Width * 72 / NSystemInformation.nfScreenDPI.Width
'get pixel over 1.0char
Dim dblPointPerPixel As Double = 72 /
NSystemInformation.nfScreenDPI.Width
Dim dblDivergePixel As Double = (1 *
dbl1CharPoint + 3.75) _
/ dblPointPerPixel
Dim dblChars As
Double = 0
If intPixel < dblDivergePixel Then
dblChars =
intPixel / dblDivergePixel
Else
dblChars = (intPixel * dblPointPerPixel - 3.75) / dbl1CharPoint
End If
Return dblChars
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
NumCharactersToPoint change
''' </summary>
''' <param name="sngNumCharacters">NumCharacters</param>
Public
Shared Function
nfNumCharactersToPoint _
(ByVal sngNumCharacters As
Single _
, ByVal fnt As Font _
) As Single
Try
Dim sizfChar As
SizeF = NFont.nfGetCharcterSize(fnt)
Dim sng As
Single = sizfChar.Width * sngNumCharacters _
* 72 / NSystemInformation.nfScreenDPI.Width
Return sng
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
NumCharactersTo1/100mm change
''' </summary>
''' <param name="intNumCharacters">NumCharacters</param>
Public
Shared Function
nfNumCharactersTo100mm _
(ByVal intNumCharacters As
Integer _
, ByVal fnt As Font _
) As Single
Try
Dim sizfChar As
SizeF = NFont.nfGetCharcterSize(fnt)
Dim sng As
Single = sizfChar.Width * intNumCharacters _
* 2540 / NSystemInformation.nfScreenDPI.Width
Return sng
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
CharactersToPixel
'''
[exp]Excel num of char-->Pixel
''' </summary>
''' <param name="sngNumCharacters">NumCharacters</param>
Public
Shared Function
nfNumCharactersToPixel _
(ByVal sngNumCharacters As
Single _
, ByVal
fnt As Font _
) As Integer
Try
Dim sizCharPixel As SizeF = NFont.nfGetCharcterSize(fnt)
Dim dbl1 As
Double = sizCharPixel.Width * sngNumCharacters
+ 5
Return Fix(dbl1 + 5 + 0.5)
Catch ex As Exception
NError.nfShow(ex,
Err.Number)
Return Nothing
End Try
End
Function
''''
<summary>
''''
BorderLineIndex
''''
</summary>
Enum
enmBorderLineIndex As Integer
Around = 1
LeftRight = 2
TopBottom = 3
DiagonalBoth = 4
DiagonalDown =
5 'Excel.XlBordersIndex.xlDiagonalDown
DiagonalUp =
6
'Excel.XlBordersIndex.xlDiagonalUp
EdgeLeft =
7
'Excel.XlBordersIndex.xlEdgeLeft
EdgeTop = 8
'Excel.XlBordersIndex.xlEdgeTop
EdgeBottom =
9
'Excel.XlBordersIndex.xlEdgeBottom
EdgeRight =
10
'Excel.XlBordersIndex.xlEdgeRight
InsideVertical =
11 'Excel.XlBordersIndex.xlInsideVertical
InsideHorizontal
= 12 'Excel.XlBordersIndex.xlInsideHorizontal
InsideBoth = 13
End
Enum
''''
<summary>
''''
BorderLineWeight
''''
</summary>
Enum
enmBorderLineWeight As Integer
None = 0
Hairline =
1 'Excel.XlBorderWeight.xlHairline
Thin = 2 'Excel.XlBorderWeight.xlThin
Medium = -4138 'Excel.XlBorderWeight.xlMedium
Thick = 4 'Excel.XlBorderWeight.xlThick
End
Enum
''''
<summary>
''''
OpenOfficeBorderLineWeight
''''
</summary>
Enum
enmOOBorderLineWeight As Integer
None = 0
Hairline = 2
Thin = 16
Medium = 35
Thick = 60
End
Enum
''''
<summary>
''''
BorderLineStyle
''''
</summary>
Enum
enmBorderLineStyle As Integer
Continuous =
1
'Excel.XlLineStyle.xlContinuous
Dash =
-4155
'Excel.XlLineStyle.xlDash
DashDot = 4
'Excel.XlLineStyle.xlDashDot
DashDotDot =
5
'Excel.XlLineStyle.xlDashDotDot
Dot = 4118
'Excel.XlLineStyle.xlDot
[Double] =
-4119 'Excel.XlLineStyle.xlDouble
LineStyleNone =
-4142 'Excel.XlLineStyle.xlLineStyleNone
SlantDashDot =
13 'Excel.XlLineStyle.xlSlantDashDot
End
Enum
''''
<summary>
''''
BorderLineColorIndex
''''
</summary>
Enum
enmBorderLineColorIndex As Integer
Automatic =
-4105 'Excel.XlColorIndex.xlColorIndexAutomatic
None =
-4142 'Excel.XlColorIndex.xlColorIndexNone
End
Enum
''''
<summary>
''''
HorizontalAlignment
''''
</summary>
Enum
enmHorizontalAlignment As Integer
LEFT
CENTER
RIGHT
End
Enum
''''
<summary>
''''
VerticalAlignment
''''
</summary>
Enum
enmVerticalAlignment As Integer
TOP
CENTER
BOTTOM
End
Enum
'Word
HorizontalAlignment
Public
Enum enmWdHorizontalAlignment As Integer
wdAlignParagraphCenter =
Word.WdParagraphAlignment.wdAlignParagraphCenter
wdAlignParagraphDistribute =
Word.WdParagraphAlignment.wdAlignParagraphDistribute
wdAlignParagraphJustify = Word.WdParagraphAlignment.wdAlignParagraphJustify
wdAlignParagraphJustifyHi =
Word.WdParagraphAlignment.wdAlignParagraphJustifyHi
wdAlignParagraphJustifyLow =
Word.WdParagraphAlignment.wdAlignParagraphJustifyLow
wdAlignParagraphJustifyMed = Word.WdParagraphAlignment.wdAlignParagraphJustifyMed
wdAlignParagraphLeft = Word.WdParagraphAlignment.wdAlignParagraphLeft
wdAlignParagraphRight = Word.WdParagraphAlignment.wdAlignParagraphRight
wdAlignParagraphThaiJustify = Word.WdParagraphAlignment.wdAlignParagraphThaiJustify
End
Enum
'Word
VerticalAlignment
Public
Enum enmWdVerticalAlignment As Integer
wdCellAlignVerticalBottom =
Word.WdCellVerticalAlignment.wdCellAlignVerticalBottom
wdCellAlignVerticalCenter = Word.WdCellVerticalAlignment.wdCellAlignVerticalCenter
wdCellAlignVerticalTop =
Word.WdCellVerticalAlignment.wdCellAlignVerticalTop
End
Enum
'Word
LineStyle
Public
Enum enmWdLineStyle As
Integer
wdLineStyleDashDot = Word.WdLineStyle.wdLineStyleDashDot
wdLineStyleDashDotDot =
Word.WdLineStyle.wdLineStyleDashDotDot
wdLineStyleDashDotStroked = Word.WdLineStyle.wdLineStyleDashDotStroked
wdLineStyleDashLargeGap = Word.WdLineStyle.wdLineStyleDashLargeGap
wdLineStyleDashSmallGap = Word.WdLineStyle.wdLineStyleDashSmallGap
wdLineStyleDot =
Word.WdLineStyle.wdLineStyleDot
wdLineStyleDouble = Word.WdLineStyle.wdLineStyleDouble
wdLineStyleDoubleWavy = Word.WdLineStyle.wdLineStyleDoubleWavy
wdLineStyleEmboss3D = Word.WdLineStyle.wdLineStyleEmboss3D
wdLineStyleEngrave3D = Word.WdLineStyle.wdLineStyleEngrave3D
wdLineStyleInset
= Word.WdLineStyle.wdLineStyleInset
wdLineStyleNone
= Word.WdLineStyle.wdLineStyleNone
wdLineStyleOutset = Word.WdLineStyle.wdLineStyleOutset
wdLineStyleSingle = Word.WdLineStyle.wdLineStyleSingle
wdLineStyleSingleWavy = Word.WdLineStyle.wdLineStyleSingleWavy
wdLineStyleThickThinLargeGap =
Word.WdLineStyle.wdLineStyleThickThinLargeGap
wdLineStyleThickThinMedGap = Word.WdLineStyle.wdLineStyleThickThinMedGap
wdLineStyleThickThinSmallGap =
Word.WdLineStyle.wdLineStyleThickThinSmallGap
wdLineStyleThinThickLargeGap =
Word.WdLineStyle.wdLineStyleThinThickLargeGap
wdLineStyleThinThickMedGap = Word.WdLineStyle.wdLineStyleThinThickMedGap
wdLineStyleThinThickSmallGap =
Word.WdLineStyle.wdLineStyleThinThickSmallGap
wdLineStyleThinThickThinLargeGap =
Word.WdLineStyle.wdLineStyleThinThickThinLargeGap
wdLineStyleThinThickThinMedGap = Word.WdLineStyle.wdLineStyleThinThickThinMedGap
wdLineStyleThinThickThinSmallGap =
Word.WdLineStyle.wdLineStyleThinThickThinSmallGap
wdLineStyleTriple = Word.WdLineStyle.wdLineStyleTriple
End
Enum
'Word
LineStyle
Public
Enum enmWdLineWidth As
Integer
wdLineWidth025pt
= Word.WdLineWidth.wdLineWidth025pt
wdLineWidth050pt
= Word.WdLineWidth.wdLineWidth050pt
wdLineWidth075pt
= Word.WdLineWidth.wdLineWidth075pt
wdLineWidth100pt
= Word.WdLineWidth.wdLineWidth100pt
wdLineWidth150pt
= Word.WdLineWidth.wdLineWidth150pt
wdLineWidth225pt
= Word.WdLineWidth.wdLineWidth225pt
wdLineWidth300pt
= Word.WdLineWidth.wdLineWidth300pt
wdLineWidth450pt
= Word.WdLineWidth.wdLineWidth450pt
wdLineWidth600pt
= Word.WdLineWidth.wdLineWidth600pt
End
Enum
'Word
Color
Public
Enum enmWdColor As
Integer
wdColorAqua =
Word.WdColor.wdColorAqua
wdColorAutomatic
= Word.WdColor.wdColorAutomatic
wdColorBlack =
Word.WdColor.wdColorBlack
wdColorBlue =
Word.WdColor.wdColorBlue
wdColorBlueGray
= Word.WdColor.wdColorBlueGray
wdColorBrightGreen = Word.WdColor.wdColorBrightGreen
wdColorBrown =
Word.WdColor.wdColorBrown
wdColorDarkBlue
= Word.WdColor.wdColorDarkBlue
wdColorDarkGreen
= Word.WdColor.wdColorDarkGreen
wdColorDarkRed =
Word.WdColor.wdColorDarkRed
wdColorDarkTeal
= Word.WdColor.wdColorDarkTeal
wdColorDarkYellow = Word.WdColor.wdColorDarkYellow
wdColorGold =
Word.WdColor.wdColorGold
wdColorGray05 =
Word.WdColor.wdColorGray05
wdColorGray10 =
Word.WdColor.wdColorGray10
wdColorGray125 =
Word.WdColor.wdColorGray125
wdColorGray15 =
Word.WdColor.wdColorGray15
wdColorGray20 =
Word.WdColor.wdColorGray20
wdColorGray25 =
Word.WdColor.wdColorGray25
wdColorGray30 =
Word.WdColor.wdColorGray30
wdColorGray35 =
Word.WdColor.wdColorGray35
wdColorGray375 =
Word.WdColor.wdColorGray375
wdColorGray40 =
Word.WdColor.wdColorGray40
wdColorGray45 =
Word.WdColor.wdColorGray45
wdColorGray50 =
Word.WdColor.wdColorGray50
wdColorGray55 =
Word.WdColor.wdColorGray55
wdColorGray60 =
Word.WdColor.wdColorGray60
wdColorGray625 =
Word.WdColor.wdColorGray625
wdColorGray65 =
Word.WdColor.wdColorGray65
wdColorGray70 =
Word.WdColor.wdColorGray70
wdColorGray75 =
Word.WdColor.wdColorGray75
wdColorGray80 =
Word.WdColor.wdColorGray80
wdColorGray85 =
Word.WdColor.wdColorGray85
wdColorGray875 =
Word.WdColor.wdColorGray875
wdColorGray90 =
Word.WdColor.wdColorGray90
wdColorGray95 =
Word.WdColor.wdColorGray95
wdColorGreen =
Word.WdColor.wdColorGreen
wdColorIndigo =
Word.WdColor.wdColorIndigo
wdColorLavender
= Word.WdColor.wdColorLavender
wdColorLightBlue =
Word.WdColor.wdColorLightBlue
wdColorLightGreen = Word.WdColor.wdColorLightGreen
wdColorLightOrange = Word.WdColor.wdColorLightOrange
wdColorLightTurquoise = Word.WdColor.wdColorLightTurquoise
wdColorLightYellow
= Word.WdColor.wdColorLightYellow
wdColorLime =
Word.WdColor.wdColorLime
wdColorOliveGreen = Word.WdColor.wdColorOliveGreen
wdColorOrange =
Word.WdColor.wdColorOrange
wdColorPaleBlue
= Word.WdColor.wdColorPaleBlue
wdColorPink =
Word.WdColor.wdColorPink
wdColorPlum =
Word.WdColor.wdColorPlum
wdColorRed =
Word.WdColor.wdColorRed
wdColorRose =
Word.WdColor.wdColorRose
wdColorSeaGreen
= Word.WdColor.wdColorSeaGreen
wdColorSkyBlue =
Word.WdColor.wdColorSkyBlue
wdColorTan =
Word.WdColor.wdColorTan
wdColorTeal =
Word.WdColor.wdColorTeal
wdColorTurquoise
= Word.WdColor.wdColorTurquoise
wdColorViolet =
Word.WdColor.wdColorViolet
wdColorWhite =
Word.WdColor.wdColorWhite
wdColorYellow =
Word.WdColor.wdColorYellow
End
Enum
''' <summary>
'''
OpenOffice Calc file check
''' </summary>
''' <param name="strFile">File</param>
Public
Shared Function
nfIsCalcFile _
(ByVal strFile As String _
) As Boolean
Try
If strFile.EndsWith(".ods",
NConst.scOrdinalIC) OrElse _
strFile.EndsWith(".pdf", NConst.scOrdinalIC) Then
Return True
End If
Return False
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
OpenOffice Writer file check
''' </summary>
''' <param name="strFile">File</param>
Public
Shared Function
nfIsWriterFile _
(ByVal strFile As String _
) As Boolean
Try
If strFile.EndsWith(".odt",
NConst.scOrdinalIC) OrElse _
strFile.EndsWith(".pdf", NConst.scOrdinalIC) Then
Return True
End If
Return False
Catch ex As Exception
NError.nfShow(ex,
Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Excel file check
''' </summary>
''' <param name="strFile">File</param>
Public
Shared Function
nfIsExcelFile _
(ByVal strFile As String _
) As Boolean
Try
If strFile.EndsWith(".xls",
NConst.scOrdinalIC) OrElse _
strFile.EndsWith(".xlsx", NConst.scOrdinalIC) Then
Return True
End If
Return False
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
''' Word
file check
''' </summary>
''' <param name="strFile">File</param>
Public
Shared Function
nfIsWordFile _
(ByVal strFile As String _
) As Boolean
Try
If strFile.EndsWith(".doc",
NConst.scOrdinalIC) OrElse _
strFile.EndsWith(".docx", NConst.scOrdinalIC) Then
Return True
End If
Return False
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
ExecuteOpenOffice
''' </summary>
''' <param name="strDocument">ex)c:\Nsystem\nss\exe\XXXX\YYYYY.doc</param>
''' <param name="strPassword">ex)Password</param>
''' <param name="blnWaitForExit">true=WaitForExit</param>
Public
Shared Function
nfExecuteOpenOffice _
(ByVal strDocument As String _
, ByVal strPassword As String _
, Optional ByVal
blnWaitForExit As Boolean
= False _
) As Boolean
Try
If NOffice.nfIsOpenOfficeInstalled = False Then
Return False
End If
Dim si As
New System.Diagnostics.ProcessStartInfo
si.UseShellExecute = False
'si.WorkingDirectory
= "c:\Program Files\OpenOffice.org 3\Basic\Program\"
si.FileName = nfGetOpenOfficeApplicationPath()
'si.Verb = "runas"
si.Arguments = strDocument
'si.WindowStyle = ProcessWindowStyle.Normal
si.UserName = Environment.UserName
Dim ss As
New System.Security.SecureString
For p1 As
Integer = 0 To
strPassword.Length - 1
ss.AppendChar(strPassword.Chars(p1))
Next
si.Password = ss
si.Domain = Environment.UserDomainName
Dim p As
System.Diagnostics.Process = System.Diagnostics.Process.Start(si)
If p IsNot
Nothing Then
If blnWaitForExit = True Then
p.WaitForExit()
End If
End If
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
Image
''' </summary>
Public
Class g_ctypImage
Public strName As String
''' <summary>OLE,Shape</summary>
Public strType As String
''' <summary>Link</summary>
Public strLinkFile As
String
''' <summary>1/100mm</summary>
Public strAddress As String
''' <summary>1/100mm</summary>
Public strSize As String
End
Class
''' <summary>
''' get
InchTextSize
''' </summary>
''' <param name="strText">Text</param>
''' <param name="fnt">Font</param>
Public
Shared Function
nfGetInchTextSize _
(ByVal strText As String _
, ByVal fnt As Font _
) As SizeF
Try
'Dim grp As Graphics = dgv.CreateGraphics
'Dim sizf As SizeF =
grp.MeasureString(strText, fnt)
'grp.Dispose()
'most same to real
Dim siz As
Size = TextRenderer.MeasureText(strText, fnt)
Return New
SizeF((siz.Width + 1) / NSystemInformation.nfScreenDPI.Width _
, (siz.Height + 3) / NSystemInformation.nfScreenDPI.Height _
)
'Return New Size(sizf.Width + 5.9, sizf.Height
+ 1)
'Return New Size(sizf.Width + 2, sizf.Height +
1)
'Return NFont.nfGetSize(Nothing, strText, fnt)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
FontToWordFont
''' </summary>
''' <param name="fnt">Font</param>
Public
Shared Function
nfFontToWordFont _
(ByVal fnt As Font _
, ByVal fntWord As
Word.Font _
) As Boolean
Try
fntWord.Name = fnt.Name
fntWord.Size = fnt.Size
fntWord.Bold = CInt(False)
fntWord.Italic = CInt(False)
fntWord.StrikeThrough = CInt(False)
fntWord.Underline = CInt(False)
If fnt.Bold = True
Then
fntWord.Bold = CInt(True)
End If
If fnt.Italic = True
Then
fntWord.Italic = CInt(True)
End If
If fnt.Strikeout = True Then
fntWord.StrikeThrough = CInt(True)
End If
If fnt.Underline = True Then
fntWord.Underline = CInt(True)
End If
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
WordFontToFont
''' </summary>
''' <param name="fntWord">WordFont</param>
Public
Shared Function
nfWordFontToFont _
(ByVal fntWord As
Word.Font _
) As Font
Try
Dim fs As
FontStyle = Nothing
If fntWord.Bold = True Then
fs = fs Or FontStyle.Bold
ElseIf fntWord.Italic = True Then
fs = fs Or FontStyle.Italic
ElseIf fntWord.StrikeThrough = True Then
fs = fs Or FontStyle.Strikeout
ElseIf fntWord.Underline = True Then
fs = fs Or FontStyle.Underline
End If
Return New
Font(fntWord.Name, fntWord.Size, fs)
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
RTF-->nNWordDoc.g_ctypParagraph()
''' </summary>
''' <param name="strRTF">RTF</param>
Public
Shared Function
nfRtfToParagraphs _
(ByVal strRTF As String _
) As nNWordDoc.g_ctypParagraph()
Try
Dim rtb As
New RichTextBox
rtb.Rtf = strRTF
rtb.SelectionStart = 0
rtb.SelectionLength = 1
Dim lst As
New List(Of
nNWordDoc.g_ctypParagraph)
Dim blnBreak As
Boolean = True
For p1 As
Integer = 0 To
rtb.TextLength
rtb.SelectionStart = p1
If blnBreak = True
Then
lst.Add(fGetParagraph(rtb))
blnBreak = False
End If
Dim strText As
String = rtb.SelectedText
'NMsgBox.nfDebugShow(strText)
With lst(lst.Count - 1)
If strText = ChrW(10) Then
.blnCRLF = True
blnBreak = True
Continue For
End If
Dim pg As
nNWordDoc.g_ctypParagraph = fGetParagraph(rtb)
If fParagraphCompare(pg, lst(lst.Count -
1)) = False Then
lst.Add(pg)
End If
lst(lst.Count - 1).strText &= strText
End With
Next
rtb.Dispose()
'NMsgBox.nfShow(lst)
Return lst.ToArray
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
Private
Shared Function
fGetParagraph _
(ByVal rtb As
RichTextBox _
) As nNWordDoc.g_ctypParagraph
Try
Dim clsParagraph As New nNWordDoc.g_ctypParagraph
If rtb.SelectionFont.Equals(rtb.Font) = False Then
If rtb.SelectionFont.Strikeout = True Then
Dim fs As
FontStyle = rtb.SelectionFont.Style
fs = fs Xor FontStyle.Strikeout
clsParagraph.fnt = New
Font(rtb.SelectionFont, fs)
clsParagraph.clsBorderLine = New
nNWordDoc.g_ctypLine
Else
clsParagraph.fnt = rtb.SelectionFont
End If
End If
If rtb.SelectionColor.ToArgb <>
rtb.ForeColor.ToArgb Then
clsParagraph.clrFont = rtb.SelectionColor
End If
Return clsParagraph
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
Private
Shared Function
fParagraphCompare _
(ByVal pg1 As
nNWordDoc.g_ctypParagraph _
, ByVal pg2 As
nNWordDoc.g_ctypParagraph _
) As Boolean
Try
If pg1.fnt Is
Nothing AndAlso
_
pg2.fnt IsNot Nothing
Then
Return False
End If
If pg1.fnt IsNot
Nothing AndAlso
_
pg2.fnt Is Nothing
Then
Return False
End If
If pg1.fnt IsNot
Nothing Then
If pg1.fnt.Equals(pg2.fnt) = False OrElse _
pg1.clrFont.Equals(pg2.clrFont) = False Then
Return False
End If
End If
If pg1.clrFont = Nothing AndAlso _
pg2.clrFont <> Nothing Then
Return False
End If
If pg1.clrFont <> Nothing AndAlso _
pg2.clrFont = Nothing Then
Return False
End If
If pg1.clrFont <> Nothing Then
If pg1.clrFont.Equals(pg2.clrFont) = False Then
Return False
End If
End If
Return True
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
''' <summary>
'''
nNWordDoc.g_ctypParagraph()-->RTF
''' </summary>
''' <param name="clsParagraphs">nNWordDoc.g_ctypParagraph</param>
''' <param name="intNumRemoveLastCRLFLines">remove last line,if its only CRLF</param>
Public
Shared Function
nfParagraphsToRtf _
(ByVal clsParagraphs() As
nNWordDoc.g_ctypParagraph _
, Optional ByVal
intNumRemoveLastCRLFLines As Integer = -1 _
) As String
Try
Dim rtb As
New RichTextBox
If intNumRemoveLastCRLFLines <> 0 AndAlso _
clsParagraphs.Length
> 0 Then
For p1 As
Integer = clsParagraphs.Length - 1 To 0 Step -1
If clsParagraphs(clsParagraphs.Length -
1).blnCRLF = True Then
clsParagraphs(clsParagraphs.Length - 1).blnCRLF = False
If clsParagraphs(clsParagraphs.Length -
1).strText = "" Then
ReDim Preserve
clsParagraphs(clsParagraphs.Length - 2)
Else
Exit For
End If
If intNumRemoveLastCRLFLines > 0 Then
intNumRemoveLastCRLFLines -= 1
If intNumRemoveLastCRLFLines = 0 Then
Exit For
End If
End If
Else
Exit For
End If
Next
End If
'Text set
Dim stb As
New StringBuilder
For p1 As
Integer = 0 To
clsParagraphs.Length - 1
With clsParagraphs(p1)
stb.Append(.strText)
If .blnCRLF = True
Then
stb.Append(vbLf)
End If
End With
Next
rtb.Text = stb.ToString
'Format
Dim pSel As
Integer = 0
For p1 As
Integer = 0 To
clsParagraphs.Length - 1
With clsParagraphs(p1)
If .fnt IsNot
Nothing Then
rtb.SelectionStart = pSel
rtb.SelectionLength = .strText.Length
Dim fs As
FontStyle = .fnt.Style
If .clsBorderLine IsNot Nothing Then
fs = fs Or FontStyle.Strikeout
rtb.SelectionFont = New Font(.fnt, fs)
Else
rtb.SelectionFont = .fnt
End If
End If
If .clrFont <> Nothing Then
rtb.SelectionStart = pSel
rtb.SelectionLength = .strText.Length
rtb.SelectionColor = .clrFont
End If
pSel += .strText.Length
If .blnCRLF = True
Then
pSel += 1
End If
End With
Next
Dim strRTF As
String = rtb.Rtf
rtb.Dispose()
Return strRTF
Catch ex As Exception
NError.nfShow(ex, Err.Number)
Return Nothing
End Try
End
Function
End Class
End Class