How I can make font bold through coding ?

If you are a VB developer and have questions about using our products from VB, here is the place to post them.
Post Reply
kamleshvgujarathi
Posts: 39
Joined: Fri Jan 09 2004
Location: Bombay ( INDIA)
Contact:

How I can make font bold through coding ?

Post by kamleshvgujarathi »

Hello I want insert on field that I can but I can not set the font Bold

Following is the code which I am trying to set font bold but I could not

Code: Select all

   With PDFCreactiveX1
      .SetLicenseKey gfn_strGetAmyuniInfo(2), gfn_strGetAmyuniInfo(3)
      .ReportState = acReportStateDesign 
      .CreateObject acObjectTypeText, "TDV"
      l_str = "Amyuni Evaluation Version"
      .ObjectAttribute("TDV", "Left") = 1
      .ObjectAttribute("TDV", "Top") = 1
      .ObjectAttribute("TDV", "Right") = 214
      .ObjectAttribute("TDV", "Bottom") = 279
      .ObjectAttribute("TDV", "TextFont") = [b]"Arial,33,Bold"[/b]
      .ObjectAttribute("TDV", "Text") = l_str
      .ObjectAttribute("TDV", "TextColor") = "C0C0C0"
      .ReportState = acReportStateRun

   End With
Please tell me how I can set the font bold runtime.

Kamlesh@itshastra.com
---------------------------
Jose
Amyuni Team
Posts: 553
Joined: Tue Oct 01 2002
Contact:

Post by Jose »

Hello,

In order to create bold text in a Text object you will need to modify the text objects "TextFont" property.

The parameter to be passed to the TextFont property is a string in the form of:
FontName,
FontSize,
Weight,
Italic,
Underline

The FontWeight value is a value between 400 and 700.

Private Sub cmdCreateObjects_Click()
With PDF1

.ReportState = acReportStateDesign
.CreateObject acObjectTypeField, "TDV"

With .GetObjectByName("TDV")
.Attribute("Left") = 1
.Attribute("Top") = 1
.Attribute("Right") = 2000
.Attribute("Bottom") = 1000
.Attribute("Text") = "Hello this is text"

.Attribute("TextFont") = "Arial,30,700,0,0"
.Attribute("BackColor") = "C0C0C0"

End With

.DoCommandTool (acCommandToolRunDocument)
.Save App.Path & "\test_vb.pdf", 1
End With
End Sub

Hope this helps?

Thanks
Post Reply