Skype:TextControlSupport
Orders:877-462-4772
TX Text Control - word processing components.

Using TX Text Control ActiveX Server in ASP.NET

TX Text Control ActiveX Server is an is usually deployed in ASP, however, it is equally possible to use it with ASP.NET. This demonstration shows you how to create a WinForms application in Visual Studio .NET that creates PDF, DOC and RTF files from data entered on a web page. This demo requires Adobe Reader (free download) to be installed.

Selective source code from demonstration application

The following is not the entire source code to this sample application, just the parts in which TX Text Control ActiveX Server is called. To see the entire source code, please download the ASP project files (see link above).

  1. <%@ Page aspCompat="True" Language="vb" ... %>
  2.  
  3. [...]
  4.  
  5. tx.Load(Server.MapPath("template.rtf"), 0, 5, 0)
  6.  
  7. tx.Find("Title:")
  8. TableId = tx.TableAtInputPos
  9.  
  10. ' loop through the DropDownLists
  11. ' to get the selected values
  12. For i = 0 To (DropDownList2.Items.Count - 1)
  13. If DropDownList2.Items(i).Selected Then
  14. text_noteMaker = DropDownList2.Items(i).Text
  15. End If
  16. Next
  17.  
  18. For i = 0 To (DropDownList1.Items.Count - 1)
  19. If DropDownList1.Items(i).Selected Then
  20. text_typeOfMeeting = DropDownList1.Items(i).Text
  21. End If
  22. Next
  23.  
  24. ' fill the table with the content
  25. tx.TableCellText(TableId,1,2) = TextBox1.Text
  26. tx.TableCellText(TableId,2,2) = text_noteMaker
  27. tx.TableCellText(TableId,1,4) = text_typeOfMeeting
  28. tx.TableCellText(TableId,2,4) = Calendar1.SelectedDate.Date
  29.  
  30. [...]
  31.  
  32. data = tx.SaveToMemoryBuffer(data, exportFormat, 0)
  33.  
  34. Response.Clear
  35.  
  36. if exportFormat = 12 then
  37. Response.ContentType = "application/pdf"
  38. Response.AddHeader("Content-Disposition", "attachment;_
  39. filename=meeting_minutes.pdf")
  40. Response.BinaryWrite(data)
  41. else if exportFormat = 9 then
  42. Response.ContentType = "application/doc"
  43. Response.AddHeader("Content-Disposition", "attachment;_
  44. filename= meeting_minutes.doc")
  45. Response.BinaryWrite(data)
  46. else if exportFormat = 5
  47. Response.ContentType = "application/rtf"
  48. Response.AddHeader("Content-Disposition", "attachment;_
  49. filename=meeting_minutes.rtf")
  50. Response.Write(data)
  51. end if
  52.  
  53. Response.End

Need help?

We would be delighted to assist you with this or any other TX Text Control ActiveX Server demonstration program. Please contact the Support Department.

top

Top 10 Bestselling Product Award 2007Top 25 Publisher Product Award 2007Top 10 Bestselling Product Award 2007 in JapanTop 25 Bestselling Product Award 2006Top 25 Bestselling Publisher Award 2006Reader's Choice Award, dot.net magazin, 3rd place