文書更新:2019年06月18日(火) 午前10時38分31秒

Home > 備忘録 > libreoffice の macro(basic) > Cell内の文字位置( 96 )

Cell内の文字位置

  1. 水平方向
  2. sub Demo
    	Dim sheet,cell As Object
    	Dim kei As Long
    	sheet=ThisComponent.CurrentController.Activesheet
    	cell=sheet.getCellRangeByName("D3")
    	cell.HoriJustify=com.sun.star.table.CellHoriJustify.STANDARD
    	cell.HoriJustify=com.sun.star.table.CellHoriJustify.LEFT
    	cell.HoriJustify=com.sun.star.table.CellHoriJustify.CENTER
    	cell.HoriJustify=com.sun.star.table.CellHoriJustify.RIGHT
    	cell.HoriJustify=com.sun.star.table.CellHoriJustify.BLOCK
    	cell.HoriJustify=com.sun.star.table.CellHoriJustify.REPEAT
    end sub
  3. 垂直方向
  4. sub Demo
    	Dim sheet,cell As Object
    	Dim kei As Long
    	sheet=ThisComponent.CurrentController.Activesheet
    	cell=sheet.getCellRangeByName("D3")
    	cell.VertJustify=com.sun.star.table.CellVertJustify.STANDARD
    	cell.VertJustify=com.sun.star.table.CellVertJustify.TOP
    	cell.VertJustify=com.sun.star.table.CellVertJustify.CENTER
    	cell.VertJustify=com.sun.star.table.CellVertJustify.BOTTOM
    end sub

シート名の取得

sub Demo
	Dim sheetName(),msg as String
	Dim i as Long
	msg=""
	sheetName=ThisComponent.Sheets.getElementNames()
	for i=0 to UBound(sheetName)
		msg=msg & sheetName(i) & Chr$(10)
	next i
	MsgBox msg
end sub