ASP.NET & PowerPoint - Font Style |
ASP.NET & PowerPoint - Font Style การกำหนดรูปแบบของ Font,Size,Color ใน Presentations
ASP.NET Config PowerPoint.Application
Syntax
ppSlide..Shapes(1).TextFrame.TextRange.Font()
Sample
Imports Microsoft.Office.Interop.PowerPoint
Public Class AspNetPowerPointFontStyle
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'*** Constant ***'
Const ppLayoutBlank = 12
Const ppLayoutChart = 8
Const ppLayoutChartAndText = 6
Const ppLayoutClipartAndText = 10
Const ppLayoutClipArtAndVerticalText = 26
Const ppLayoutFourObjects = 24
Const ppLayoutLargeObject = 15
Const ppLayoutMediaClipAndText = 18
Const ppLayoutMixed = -2
Const ppLayoutObject = 16
Const ppLayoutObjectAndText = 14
Const ppLayoutObjectAndTwoObjects = 30
Const ppLayoutObjectOverText = 19
Const ppLayoutOrgchart = 7
Const ppLayoutTable = 4
Const ppLayoutText = 2
Const ppLayoutTextAndChart = 5
Const ppLayoutTextAndClipart = 9
Const ppLayoutTextAndMediaClip = 17
Const ppLayoutTextAndObject = 13
Const ppLayoutTextAndTwoObjects = 21
Const ppLayoutTextOverObject = 20
Const ppLayoutTitle = 1
Const ppLayoutTitleOnly = 11
Const ppLayoutTwoColumnText = 3
Const ppLayoutTwoObjects = 29
Const ppLayoutTwoObjectsAndObject = 31
Const ppLayoutTwoObjectsAndText = 22
Const ppLayoutTwoObjectsOverText = 23
Const ppLayoutVerticalText = 25
Const ppLayoutVerticalTitleAndText = 27
Const ppLayoutVerticalTitleAndTextOverChart = 28
'*** Font Color ***'
Const wdColorLightGreen = &HCCFFCC
Const wdColorBlue = &HFF0000
Dim ppApp As New Microsoft.Office.Interop.PowerPoint.Application
Dim ppPres As Presentation
Dim ppSlide1 As Slide
Dim ppName As String = "MyPP/MyPPt.ppt"
ppPres = ppApp.Presentations.Add(1)
ppSlide1 = ppPres.Slides.Add(1, ppLayoutTitleOnly)
'*** AddTextbox, objControl.Left,objControl.Top,objControl.Width,objControl.Height ***'
ppSlide1.Shapes.AddTextbox(1, 50, 100, 700, 100) '***4
ppSlide1.Shapes(1).TextFrame.TextRange.Text = "I Love ThaiCreate.Com 1"
ppSlide1.Shapes(1).TextFrame.TextRange.Font.Name = "Arial"
ppSlide1.Shapes(1).TextFrame.TextRange.Font.Size = 10
ppSlide1.Shapes(1).TextFrame.TextRange.Font.Color.RGB = wdColorLightGreen
ppSlide1.Shapes.AddTextbox(1, 50, 150, 700, 100)
ppSlide1.Shapes(2).TextFrame.TextRange.Text = "I Love ThaiCreate.Com 2"
ppSlide1.Shapes(2).TextFrame.TextRange.Font.Name = "Arial"
ppSlide1.Shapes(2).TextFrame.TextRange.Font.Size = 20
ppSlide1.Shapes.AddTextbox(1, 50, 200, 700, 100)
ppSlide1.Shapes(3).TextFrame.TextRange.Text = "I Love ThaiCreate.Com 3"
ppSlide1.Shapes(3).TextFrame.TextRange.Font.Name = "Arial"
ppSlide1.Shapes(3).TextFrame.TextRange.Font.Size = 30
ppSlide1.Shapes.AddTextbox(1, 50, 250, 700, 100)
ppSlide1.Shapes(4).TextFrame.TextRange.Text = "I Love ThaiCreate.Com 4"
ppSlide1.Shapes(4).TextFrame.TextRange.Font.Name = "Arial"
ppSlide1.Shapes(4).TextFrame.TextRange.Font.Size = 40
ppSlide1.Shapes.AddTextbox(1, 50, 300, 700, 100)
ppSlide1.Shapes(5).TextFrame.TextRange.Text = "I Love ThaiCreate.Com 5"
ppSlide1.Shapes(5).TextFrame.TextRange.Font.Name = "Arial"
ppSlide1.Shapes(5).TextFrame.TextRange.Font.Size = 50
ppSlide1.Shapes(5).TextFrame.TextRange.Font.Color.RGB = wdColorBlue
ppApp.Presentations(1).SaveAs(Server.MapPath(ppName))
ppApp.Quit()
ppApp = Nothing
Me.lblText.Text = "PowerPoint Created <a href=" & ppName & ">Click here</a> to Download."
'*** Font Color ***'
'Const wdColorAqua = &HCCCC33
'Const wdColorAutomatic = &HFF000000
'Const wdColorBlack = &H0
'Const wdColorBlue = &HFF0000
'Const wdColorBlueGray = &H996666
'Const wdColorBrightGreen = &HFF00
'Const wdColorBrown = &H3399
'Const wdColorDarkBlue = &H800000
'Const wdColorDarkGreen = &H3300
'Const wdColorDarkRed = &H80
'Const wdColorDarkTeal = &H663300
'Const wdColorDarkYellow = &H8080
'Const wdColorGold = &HCCFF
'Const wdColorGray05 = &HF3F3F3
'Const wdColorGray10 = &HE6E6E6
'Const wdColorGray125 = &HE0E0E0
'Const wdColorGray15 = &HD9D9D9
'Const wdColorGray20 = &HCCCCCC
'Const wdColorGray25 = &HC0C0C0
'Const wdColorGray30 = &HB3B3B3
'Const wdColorGray35 = &HA6A6A6
'Const wdColorGray375 = &HA0A0A0
'Const wdColorGray40 = &H999999
'Const wdColorGray45 = &H8C8C8C
'Const wdColorGray50 = &H808080
'Const wdColorGray55 = &H737373
'Const wdColorGray60 = &H666666
'Const wdColorGray625 = &H606060
'Const wdColorGray65 = &H595959
'Const wdColorGray70 = &H4C4C4C
'Const wdColorGray75 = &H404040
'Const wdColorGray80 = &H333333
'Const wdColorGray85 = &H262626
'Const wdColorGray875 = &H202020
'Const wdColorGray90 = &H191919
'Const wdColorGray95 = &HC0C0C
'Const wdColorGreen = &H8000
'Const wdColorIndigo = &H993333
'Const wdColorLavender = &HFF99CC
'Const wdColorLightBlue = &HFF6633
'Const wdColorLightGreen = &HCCFFCC
'Const wdColorLightOrange = &H99FF
'Const wdColorLightTurquoise = &HFFFFCC
'Const wdColorLightYellow = &H99FFFF
'Const wdColorLime = &HCC99
'Const wdColorOliveGreen = &H3333
'Const wdColorOrange = &H66FF
'Const wdColorPaleBlue = &HFFCC99
'Const wdColorPink = &HFF00FF
'Const wdColorPlum = &H663399
'Const wdColorRed = &HFF
'Const wdColorRose = &HCC99FF
'Const wdColorSeaGreen = &H669933
'Const wdColorSkyBlue = &HFFCC00
'Const wdColorTan = &H99CCFF
'Const wdColorTeal = &H808000
'Const wdColorTurquoise = &HFFFF00
'Const wdColorViolet = &H800080
'Const wdColorWhite = &HFFFFFF
'Const wdColorYellow = &HFFFF
End Sub
End Class
Screenshot
ดาวน์โหลด Code ทั้งหมดได้จากในส่วนของดาวน์โหลด
|