Powerful web printing tool-pbdatawindow

Source: Internet
Author: User
ArticleDirectory
    • Business scenarios
Business scenarios

Some time ago, the company wanted to get Pb stuff to ASP. net project, and implement printing. I have considered using the crystal report, so that the Pb datawindow (data window) Will not be used, this is a heartache, and the crystal report is equivalent to a chicken rib. (The Dark table in the book, Pb datawindow is quite powerful, it is a pity that you don't have ). after multiple probing and verification, Pb datawindow has an active web control called active datawindow. in fact, Sybase itself launched the data‑embedded net, but I personally feel that it is not easy to use the active datawindow.

In addition to the strength of active datawindow

L data can be loaded as strings

L Asp.net's style sheet, JSCodeNo, we only need to load data to the dataset or able object in the background, call a method to convert to a string, and load it directly.

L Pb can be used to create an object in datawindow using the create method. The same syntax can be called directly in active datawindow. This maximizes the solution to the sharing problem between PB and net.

Well, I will not talk much about it. Let's take a look at the whole, as shown in-1. This post will explain in detail how to use this control to implement web printing.

Figure-1

How about it? The effect is okay! In the display area, the active datawindow control is used. if you splice an HTML string, you may need to splice it for a while, and the HTML style can also be spliced. at least for me, I will go crazy. currently, web development is popular in the following sentence: separation of behavior and structure!

Implementation environment

First, install a pb11.5 file. The reason is that the DLL and CAB files are required. If you have these DLL and cab packages, add the necessary DLL files of Pb, you can also disable pb11.5 (all DLL and CAB files can be downloaded ). the file list is shown in-2 and figure-3.

Figure 2

Figure-3

If you have installed pb11.5

The cab file is in the \ Sybase \ shared \ PowerBuilder folder.

DLL files are in the \ Sybase \ PowerBuilder 11.5 \ DOTNET \ bin folder. Some DLL files are required by Pb, which can be found in the/window/system32/folder of the system disk and start with Pb.

Steps

The following shows how powerful an instance is.

Step 2: Set up the environment, create a web project solution, and put the previously installed cab and DLL files in. The overall layout is shown in-4.

Figure 4

Under this note

App_code is a class encapsulated for this control.

Cab is the control installation package

PBL is the data window display part. The style, layout, and non-data parts of a page are stored here.

The JS file under public is also the JS front-end class encapsulated for this control.

Note that the data loaded by this control is loaded from the backend using the Ajax method. Therefore, the data volume produced by front-end interaction is large and must be stored on the web. add the following code to config, as shown in-5.

Figure 5

Second, we need to layout a page, such as the style, text size, and color. Here we use pb11.5. Currently, there is no good tool to use PB to draw data windows, -as shown in figure 6, we have drawn a page.

Figure 6

The text size, Font, and color can be adjusted. You can also export the data window to a string file, as shown in-7.

Figure-7

After a file is saved as a string, there are many benefits!

Step 2: reference this control on the page, as shown in-8

Figure-8

After the introduction, all the preparations will be completed, and then the code will be written directly.

Step 2: Program Data Loading. Ajax is used to extract data from the background and load the data on the foreground. Let's take a look at the background code, as shown in-9.

Figure-9

Let's talk about the code.

1. first, create a datastore object, which is equivalent to dataset/datatable in net, that is, a dataset. When creating a dataset, specify the data window to which it belongs (equivalent to a data source or an SQL statement)

2. next, we will load the data in this control to the dataset or able object, and then bind the data through ds_print.retrieve (table_data, after loading, upload the data to the front-end page through Ajax. After receiving the value on the front-end page, load the data according to the code shown in figure-10.

Figure-10

Now, the data loading process is complete. Let's look at the final result, as shown in-11.

Figure-11

The provided sample project contains detailed code, which is not described here.

Development conclusion

1. During the entire development process, the most complex link is the page Painting Process. Loading data only needs to be loaded into the dataset/datatable object.

2. dynamically assign values to controls, as shown in-12. You can also dynamically create and delete controls, including images and computing domains.

Figure-12

3. There are no problems with complicated reports, such as master details, headers, table tails, and nesting.

Conclusion

The implementation of CS printing in BS software is really a powerful tool for BS software printing. It is strongly recommended here!

FAQ

1. Q: no response is returned when a print event is executed?

A: You must specify a printer name in the front-end code.-13

Figure 13

2. Q: Can all controls be dynamically created?

A: Yes. Refer to the pbdwmodelwebui class method.

3. Q: How do I handle reports with headers, table bodies, and table tails?

A: When creating a data window, you can create a composite data window to load data to the child data window in this data window. For detailed code, see pbdwmodelwebui class.

4. Q: In the data window, how does one load the data source from the drop-down menu?

A: think of the data source from the drop-down menu as a datatable, which is also equivalent to a sub-data window. For detailed code, see pbdwmodelwebui class.

5. Q: Where can I find the help document for this control?

A: You can find it in the pb11.5 programming environment, as shown in-14. On the browser page, select the OLE page.

Figure 14

6. Q: a message is displayed, indicating that the control fails to be installed.

A: In ie option-advanced, set the options of the Active Control to prompt or enable. If the options are still unavailable, choose ie option-> Security-> Custom Level, set the options of the Active Control to prompt or enable.

Finally, I wish you a pleasant use of this control. At the same time, I will provide technical support for this control for free!

 

Source code: webpbdatawindow

 

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.