Barcode for Office Help

Contents

LICENSE AGREEMENT
Getting Started
Exporting Barcode
Barcode Dimensions
Barcode Properties
Menus
"Insert a Native Character" Dialog
Status Bar
Automation

LICENSE AGREEMENT

Each license gives you the right to use Barcode for Office on a single computer; in addition, this license also includes a Barcode/ActiveX developer's license.

Bokai Corporation makes no warranties, express or implied, and specifically disclaims any implied warranties of merchantability or fitness for any particular purpose. In no event shall Bokai Corporation be liable for any special, incidental or consequential damages even if Bokai Corporation has been advised of the possibility of the same.

Getting Started

Barcode for Office allows you to design barcodes that you can then transfer to your other applications, like Microsoft Office, manually or through code or macros. You can either copy/paste a barcode as an image or save it to a file; supported image formats include Enhanced Metafile, Windows Metafile, Bitmap, JPEG and PNG.

Barcode for Office also supports an Automation programming interface, which allows you to invoke most of its functions from within your own scripts or programs.

Barcode for Office also comes with the Barcode/ActiveX control, which is also a product by itself. You may use Barcode/ActiveX to develop your own applications; you may also use it directly in applications like Microsoft Office, in which case you are not using Barcode for Office. For detailed information, please refer to that product's documentation.

If you have to set up the product manually, you need only two files: barcode4office.exe and ezbarx32.ocx, the latter being an ActiveX control and requiring registration with Windows (regsvr32.exe ezbarx32.ocx).

Exporting Barcode

Once you've designed your barcode, you can transfer it to another application through several means:

Copy/Paste As Enhanced Metafile, Windows Metafile, Bitmap or an instance of the BarCode/ActiveX Control.
Drag and Drop As Enhanced Metafile.
Save Image To a file as Enhanced Metafile, Windows Metafile, Bitmap, JPEG or PNG.

Enhanced Metafile and Windows Metafile are the preferred formats since the image can scale without distortion. Windows Metafile is provided in order to support (very) old applications that do not support Enhanced Metafile.

Barcode Dimensions

The most important thing is that you not make your barcode too small. The Status Bar shows the width of a barcode module, i.e., the width of the narrow bar, in current printer pixels and in inches.

Your barcode specification tells you in what range the module width should be; in general it's no smaller than 0.01 inch. However, you'll also need to take into account your printer resolution because of the distortion associated with printing an image. If the module width is indicated to be 4 printer pixels, the actual printed width might be 1 less or more; so the distortion might reach 25%. So it might not be wise to go below 4 or 3 pixels for module width, because of printing distortion, even if the width in inches is still in the acceptable range.

Barcode Properties

Data Tab

Barcode Type Select the barcode type. Do this before you change any other properties as this will reset all other properties (except colors and font).
Data Enter the barcode data for which the barcode is to be generated.
Caption Enter a text that you want to overwrite the default barcode caption that's based on the barcode data. The caption does not change the barcode itself.
Add-On Data Enter the barcode add-on data if the barcode type has an add-on.
Add-On Caption Enter a text that you want to overwrite the default barcode add-on caption that's based on the barcode add-on data. This does not change the barcode itself.
Action on Invalid Data Select what to do when the barcode data is invalid.

Styles Tab

Pixel Aligned You need to leave this checked so that each barcode bar is mapped to a multiple of printer pixels; it has an effect only if you print barcodes directly from Barcode for Office. When it's checked, the barcode width can only grow discreetly: minimum width, twice that, three times that, etc. Note that a similar option exists for the barcode displayed on the screen: Menu View | Pixel Aligned on Screen.
Show Code 39 Start/Stop Applicable only to Code 39 barcodes. Determines whether the start and stop characters (asterisk *) are to be shown in the caption.
UPC Smaller Font Determines whether the first and last digits of a UPC type barcode should be displayed with a smaller font in the caption.
Background Transparent Determines whether the barcode image will use a transparent background. Not all image formats support transparency.
Stretch Text Determines whether the barcode caption should be stretched to take the whole width of the barcode.
EAN/UPC One Bar Length Determines whether to use a single bar height throughout. Applicable only to the UPC and EAN barcode types.
Retain Aspect Ratio Determines if the original width/height ratio should be retained when the barcode width is adjusted due to pixel alignment.

Align Tab

Horizontal Alignment Determines the horizontal alignment of the barcode within the desired rectangle.
Vertical Alignment Determines the vertical alignment of the barcode within the desired rectangle.
Main Text Position Determines the position of the main barcode caption.
Add-On Text Position Determines the position of the add-on barcode caption.
Orientation Determines the rotation of the barcode image. When set to 90 or 180, the barcode on the screen may not look correct. This is due to the Pixel Aligned on Screen option set to false by default in order to show you the correct barcode size. The printed barcode (or the image you place on the clipboard) will be OK despite this, as long as you leave Pixel Aligned at true on the Styles Tab of Barcode Properties.

Fonts Tab

Allows you to choose the font used to draw the barcode captions.

Colors Tab

ForeColor Determines the color of the barcode bars and captions.
BackColor Determines the barcode background color.

Tuning Tab

Use this screen only if you have a good understanding of the barcode specification for the particular barcode type you are using. It allows you to change the barcode bar and space widths as well as barcode margins and the middle area separating main and add-on barcodes. All numbers are relative to each other.

Menus

File Menu

New Creates a new configuration file.
Open Opens an existing configuration file.
Save Config Saves the current configuration using the same file name.
Save As Saves the current configuration to a specified file name.
Save Barcode As Image Saves the current barcode image to a specified file name.
Print Prints the current barcode.
Print Setup Selects a printer and printer connection.
<Recent File Name> Opens this configuration file.
Exit Exits Barcode for Office.

Edit Menu

Copy As Image (All Formats) Copies the current barcode to the clipboard as an image in the Enhanced Metafile, Windows Metafile, and bitmap formats.
Copy As Enhanced Metafile Copies the current barcode to the clipboard as an Enhanced Metafile.
Copy As Windows Metafile Copies the current barcode to the clipboard as a Windows Metafile.
Copy As Bitmap Copies the current barcode to the clipboard as a bitmap.
Copy As ActiveX Control Copies the current barcode to the clipboard as an ActiveX Control.
Insert a Native Character Append a special character to the barcode data, one that has no ASCII definition or that cannot be entered normally using the keyboard.

View Menu

Pixel Aligned on Screen Show the barcode pixel aligned or not on the screen.
Barcode Property Sheet Show or hide the barcode property sheet.
Toolbar Show or hide the toolbar.
Status Bar Show or hide the status bar.

Help Menu

Help Topics Shows Help Topics.
About Barcode for Office Shows information about Barcode for Office.

"Insert a Native Character" Dialog

Use this dialog box to enter into the barcode data a character that has no ASCII equivalent or one that cannot be entered by typing on the keyboard. You must use the corresponding character code as defined by the barcode specification (this is typically different from the ASCII code even if an ASCII equivalent exists).

For Code-128 and EAN-128 barcodes, instead of entering the character code, you can also directly select from the dropdown list, if you see the character you want there.

Status Bar

We use the below sample to explain how the Status Bar information is presented:

0.53",0.53" Current barcode position in inches.
3.36",1.59" Current barcode size in inches.
154 modules, 5.2px or 0.021" each The barcode width is equivalent to that of 154 narrow bars (modules). The current module width is 5.2 printer pixels or 0.021 inch

Automation

You can access the Barcode for Office functionalities programatically through its Automation interface; for example, you might want to automate Barcode for Office from within Microsoft Office so that you can generate a barcode metafile dynamically and then paste it into your Office document.

Note that, if the application from which you want to automate Barcode for Office supports ActiveX Controls, you may also use Barcode/ActiveX directly; indeed, you can insert Barcode/ActiveX directly into a Microsoft Office document without using Barcode for Office.

Object Model

First, you need to create Barcode for Office application object using the ProgID Barcode4Office.Document. For example, you would do in Visual Basic,

    Dim b4o As Barcode4Office.Document
    Set b4o = New Barcode4Office.Document

Then you can start automating the application by accessing its properties and methods.

Barcode This is the most important property of all; it is readonly and gives you the Barcode ActiveX Control object, through which you can modify the barcode. Essentially, you can achieve everything you can already do through the Barcode Property Sheet by setting this Barcode AciveX Control properties. You can also copy the barcode image to the clipboard by calling a method, or to save the barcode image to a file. Please refer to the Barcode/ActiveX documentation. Some of the important properties/methods are the BarcodeType property and Data property.
ActivePrinter You can specify the current printer through this property. For example, This would set the current printer to a local printer called "HP LaserJet 5L":
    b4o.ActivePrinter = "HP LaserJet 5L"

Another example: this would set the current printer to a network printer that's on the machine PRNTSVR:

    b4o.ActivePrinter = "\\PRNTSVR\Epson LX 810"
Visible Use this property to make the application visible. By default, the application runs invisible. Once you have made the application visible, it can no longer be closed through automation; you'll have to close it interactively using its user interface.
New() Use this method to open a new Barcode for Office configuration document.
Open(filePath) Use this method to open an existing Barcode for Office configuration file.
Save() Use this method to save the current configuration to the current configuration file.
SaveAs(filePath) Use this method to save the current configuration to the passed in file name.
SetBarcodeSize(width, height, unit, sizePerNarrowBar) Use this method to change the barcode size in Barcode for Office. The interpretation of width and height parameters depends on the value of unit:
0 Screen pixels
1 TWIPS or 1/1440 inch
2 Low Metric or 0.1 mm
3 High Metric or 0.01 mm
4 Low English or 0.01 inch
5 High English or mils or 0.001 inch
Also, if sizePerNarrowBar is true, then width (or height if the barcode is rotated 90 or 270 degree) indicates the size of the narrow bar instead of that of the entire barcode.
SetBarcodePosition(left, top, unit) Use this method to change the barcode position. As in the SetBarcodeSize method above, you may specify left and top in the unit you want, by using the unit paraemter.
PrintBarcode() Use this method print the current barcode.
CopyImage(imageFormat, clipboardAlreadyOpen) Use this method to copy the current barcode as an image in the specified format to the Clipboard; imageFormat may be one of three integers:
0 Bitmap
4 Enhanced Metafile
5 Windows Metafile
clipboardAlreadyOpen should be False typically. If it is True, you should call OpenClipboard() and EmptyClipboard() before calling CopyImage() and call CloseClipboard() after; you might do this if you need to call CopyImage multiple times to put several image formats onto the Clipboard.
CopyControl() Use this method to copy a Barcode Control to the clipboard that has the exact configuration as the current barcode.
RefreshWindow() Use this method to refresh the Barcode for Office application window.

Sample Code

The following Visual Basic sample code launches Barcode for Office, sets the barcode type, sets the barcode data, changes the barcode size, copies the barcode image in Enhanced Metafile format, and then shuts down Barcode for Office.

    Dim b4o As Barcode4Office.Document
    Set b4o = New Barcode4Office.Document
    b4o.Barcode.BarcodeType = 5     'UPC-A
    b4o.Barcode.Data = "63692000213"
    b4o.SetBarcodeSize 1300, 600, 5, False  'in mils or 0.001 inch
    b4o.CopyImage 4, False   'as Enhanced Metafile
    Set b4o = Nothing