ComponentOne VSView 8.0
URL Property

Returns or sets the name of a URL (Universal Resource Locator) to load into the control.

Syntax

[form!]VSPrinter.URL[ = value As String ]

Remarks

This property is especially useful when the VSPrinter control is used on a Web page. Setting the URL property causes the control to download the requested file from the server and load it into the control. The URL may refer to a file containing plain ASCII text, RTF text, or to a VSPrinter document saved with the SaveDoc method.

If you are using the VSPrinter control in a host application that has a Web context (such as Microsoft® Internet Explorer), you can specify an absolute path (for example, http://myserver/start.htm) or a relative path that does not include the protocol, or domain, or path (for example, page2.htm). If you specify a relative URL, the path is relative to the page in which the VSPrinter control appears. If you specify a URL that is not valid, the VSPrinter control will set the Error property to "File Not Found" and will fire the Error event.

When you assign a value to the URL property, the file is loaded asynchronously, that is, your code continues to execute while the document is being downloaded. You can monitor this process using the ReadyState property and the ReadyStateChange event. For more details and an example, refer to the ReadyState property documentation.

There are many Web-based scenarios where the URL property is useful:

You can use a VSPrinter control on the server to generate reports and save them on the server using the SaveDoc method. Then publish a Web page containing another VSPrinter control and use the URL property to load the reports on the client, where they could be previewed and printed exactly the way they were created (with headers, footers, graphical elements, page breaks, and so on). Because the SaveDoc method creates compressed files by default, the reports can be downloaded quickly.

You can use a VSPrinter control on a Web page to distribute RTF files, eliminating the need to convert them into HTML and taking advantage of the built-in document navigation interface provided by the NavBar property.

The following example shows how you could use the URL property to load different types of files from a Web site into a VSPrinter control hosted on a Web page:

<html>

<head>

<title>VSPrinter8 URL</title>

</head>

 

<script language=vbscript>

Sub btnLoadText_OnClick()

  vp.URL = "http:\\localserver\samplefiles\readme.txt"

End Sub

Sub btnLoadRTF_OnClick()

  vp.URL = "http:\\localserver\samplefiles\readme.rtf"

End Sub

Sub btnLoadVP_OnClick()

  vp.URL = "http:\\localserver\samplefiles\readme.vp"

End Sub

</script>

 

<body>

<p>This is a <b>VSPrinter8</b> control:</p>

<p>

<object classid="clsid:A8561647-E93C-11D3-AC3B-CE6078F7B616"

  id=vp width=250 height=350>

</object>

</p>

<p>

1: <input type=button value="Load Text File" name=btnLoadText><br>

2: <input type=button value="Load RTF File" name=btnLoadRTF><br>

3: <input type=button value="Load VSPrint Document" name=btnLoadVP><br>

</p>

</body>

</html>

Data Type

String

 

 


Copyright (c) GrapeCity, inc. All rights reserved.

Product Support Forum  |  Documentation Feedback