How to change PPT table font size

Get help with using AutoHotkey and its commands and hotkeys
daiweisc
Posts: 31
Joined: 19 Oct 2019, 04:27

How to change PPT table font size

15 Jun 2020, 21:45

The code run with no error ,but table font size can not change. Who can help me.

Code: Select all

#SingleInstance,Force
#NoEnv
#Include 11DateSet.ahk
SourcePattern := "F:\华鹤煤化\生产管理部\生产管理部台帐\工艺装备例会汇报材料.pptx"
DestPattern := "F:\华鹤煤化\生产管理部\生产管理部台帐\" DateCn "工艺装备例会汇报材料.pptx"
FileCopy,% SourcePattern,% DestPattern
oPPT := ComObjCreate("PowerPoint.Application")
;oPPT.visible := 0
pptPath := DestPattern
oSlide := oPPT.Presentations.Open(pptPath,,,0)
xl := ComObjCreate("Excel.Application")
Global oSlide,xl,Number
Number := 1
;--------------------------------------------------------------------------------------
ExcelToPPT(ExcelPath,Sheet,oRange,pptIndex,ShapeLeft,ShapeTop){
	Clipboard := ""
	wrkbk :=xl.Workbooks.Open(ExcelPath)
	wrkbk.WorkSheets(Sheet).Range(oRange).Copy      ; or xl.Range(oRange).Copy
	oSlide.Slides(pptIndex).Shapes.Paste
    num := oSlide.Slides(pptIndex).Shapes.Count
    Table := oSlide.Slides(pptIndex).Shapes(num)
    Table.Name := "MyTable" Number
    Table.Left := ShapeLeft
    Table.Top := ShapeTop
    TableFont := ActivePresentation.Slides(pptIndex).Shapes(num).Range.Font
    TableFont.Name := "宋体"
    TableFont.Size := 20
    ;Table.table.ApplyStyle("中度样式2-强调2")
    ;Table.ApplyStyle("MediumStlye2Accent2")
	Clipboard := ""
	wrkbk.Close(0)
    Number += 1
}
ExcelPath := "F:\华鹤煤化\生产管理部\生产管理部台帐\" 年 "年台账\" 年 "产量能耗统计.xlsx"
Sheet := "产量"
oRange := "A2:D10"
pptIndex := 5
ShapeLeft := 80
ShapeTop := 200
ExcelToPPT(ExcelPath,Sheet,oRange,pptIndex,ShapeLeft,ShapeTop)
;------------------------------------------------------------------------------------
xl.Quit()
xl := ""
oSlide.Save
oPPT.quit
oPPT := ""
ExitApp
User avatar
flyingDman
Posts: 844
Joined: 29 Sep 2013, 19:01

Re: How to change PPT table font size

15 Jun 2020, 23:37

Rather than trying to format the table inside PP, make the appropriate font changes in Excel and then paste in PP. Formatting a table in PP is complicated (though not impossible) as shown here: https://stackoverflow.com/questions/31821984/formatting-table-in-powerpoint-macro.
daiweisc
Posts: 31
Joined: 19 Oct 2019, 04:27

Re: How to change PPT table font size

16 Jun 2020, 01:14

Thanks your reply. Not change Font. But How I can change the TableStyle.
daiweisc
Posts: 31
Joined: 19 Oct 2019, 04:27

Re: How to change PPT table font size

16 Jun 2020, 20:35

Thanks flyingDman. I solve all problem. It's OK.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], GamesOfFreak, kiwiboost, Lorien, teadrinker, Xtra and 71 guests