Skip to main content

Search OfficeIMO

Enter a topic, API type, or PowerShell command.

Documentation Search all OfficeIMO/
Cmdlet

Add-OfficeExcelBarcode

Aliases: ExcelBarcode
Module
PSWriteOffice
Aliases
ExcelBarcode
Inputs
OfficeIMO.Excel.ExcelDocument
Outputs
OfficeIMO.Excel.ExcelImage

Adds a QR code or barcode anchored at a worksheet cell.

Syntax

Add-OfficeExcelBarcode
[-Address <String>]
[-AlternativeText <String>]
[-BackgroundColor <OfficeColor>]
[-Color <OfficeColor>]
[-Document <ExcelDocument>]
[-ErrorCorrection <L|M|Q|H>]
[-Height <OfficeLength>]
[-NoHumanReadableText]
[-PassThru]
[-QuietZone <Int32>]
[-Sheet <OfficeSheetSelector>]
[-Text] <String>
[-Type <SymbolFormat>]
[-Width <OfficeLength>]
[<CommonParameters>]
#
Parameter set: All Parameter Sets

Description

The code is an SVG picture with a PNG fallback, so Excel draws it sharply and older readers still show it; OfficeIMO's PDF conversion places it at print resolution. Two-dimensional codes default to 1.25 inches wide; linear barcodes to 0.33 mm per bar module, with their text underneath. The alternative text defaults to the symbology and the encoded text.

Examples

Put a QR code next to a product row.

New-OfficeExcel -Path .\Catalog.xlsx {
    ExcelSheet 'Products' {
        ExcelCell -Address A2 -Value 'Contoso Router X2'
        ExcelBarcode 'https://contoso.example/x2' -Address B2 -Width 2cm
    }
}

Add an EAN-13 barcode to an existing workbook.

ExcelBarcode '590123412345' -Type Ean -Document $book -Sheet Labels -Address C4

Parameters

-Address String optional
A1 reference of the anchor cell; defaults to A1.
-AlternativeText String optional
Accessible description; defaults to the symbology and the encoded text.
-BackgroundColor OfficeColor optional
Background and quiet zone color; a literal color.
-Color OfficeColor optional
Color of the bars or dark modules; a literal color such as Black or #1F3864.
-Document ExcelDocument optionalpipeline: True (ByValue)
Workbook to modify outside the Excel DSL.
-ErrorCorrection QrErrorCorrectionLevel optional
QR error correction level: L, M, Q or H.
Possible values: L, M, Q, H
-Height OfficeLength optional
Height of the whole symbol including human-readable text; numbers mean points.
-NoHumanReadableText SwitchParameter optional
Leave out the human-readable text that linear barcodes print under the bars.
-PassThru SwitchParameter optional
Return the native editable ExcelImage.
-QuietZone Int32 optional
Light margin around the symbol, in modules.
-Sheet OfficeSheetSelector optional
Sheet name, one-based position or native worksheet belonging to Document.
-Text String requiredposition: 0
Text, URL or other data to encode.
-Type SymbolFormat optional
Symbology; QR code by default. Any CodeGlyphX format, such as Code128, Ean, UpcA, DataMatrix or Pdf417.
Possible values: QrCode, MicroQrCode, Aztec, Code128, Gs1Code128, Code39, Code93, Ean, UpcA, UpcE, Itf14, Itf, Industrial2Of5, Matrix2Of5, Iata2Of5, PatchCode, Codabar, Msi, Code11, Plessey, Telepen, Pharmacode, PharmacodeTwoTrack, Code32, Postnet, Planet, RoyalMail4State, AustraliaPost, JapanPost, Gs1DataBarTruncated, Gs1DataBarOmnidirectional, Gs1DataBarStacked, Gs1DataBarExpanded, Gs1DataBarExpandedStacked, UspsIntelligentMail, KixCode, DataMatrix, Pdf417, MicroPdf417, RmQrCode, Gs1DataBarLimited, Gs1DataBarStackedOmnidirectional, MaxiCode, DotCode, HanXin, Gs1Composite, Ean2, Ean5, TelepenNumeric, Coop2Of5, Datalogic2Of5, Bc412, FacingIdentificationMark, Daft, Flattermarken, ChannelCode, Code16K, Code49, CodablockF, PosiCode, Mailmark4State, D3Aqr, AztecRune, CodeOne, Ultracode
-Width OfficeLength optional
Width of the whole symbol including its quiet zone; numbers mean points.

Common Parameters

This command supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.

For more information, see about_CommonParameters.