Cmdlet
Add-OfficeExcelBarcode
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 SetsDescription
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 C4Parameters
- -Address String
- A1 reference of the anchor cell; defaults to A1.
- -AlternativeText String
- Accessible description; defaults to the symbology and the encoded text.
- -BackgroundColor OfficeColor
- Background and quiet zone color; a literal color.
- -Color OfficeColor
- Color of the bars or dark modules; a literal color such as Black or #1F3864.
- -Document ExcelDocument
- Workbook to modify outside the Excel DSL.
- -ErrorCorrection QrErrorCorrectionLevel
- QR error correction level: L, M, Q or H.
- Possible values:
L,M,Q,H - -Height OfficeLength
- Height of the whole symbol including human-readable text; numbers mean points.
- -NoHumanReadableText SwitchParameter
- Leave out the human-readable text that linear barcodes print under the bars.
- -PassThru SwitchParameter
- Return the native editable ExcelImage.
- -QuietZone Int32
- Light margin around the symbol, in modules.
- -Sheet OfficeSheetSelector
- Sheet name, one-based position or native worksheet belonging to Document.
- -Text String
- Text, URL or other data to encode.
- -Type SymbolFormat
- 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
- 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.