dymosoftware / dymo-connect-framework

DYMO Connect Framework for Javascript.
Other
91 stars 53 forks source link

Ignored newlines in address when printing #64

Open 1Mpuls3 opened 2 years ago

1Mpuls3 commented 2 years ago

Hi,

I'm setting an address object text using setObjectText('Adresse', text) Here's my address string

let address_formatted = `${(address.firstname.length ? address.firstname : '')} ${(address.lastname.length ? address.lastname : '')}\n`
        address_formatted += `${(!address.company ? "" : address.company  + "\n")}`
        address_formatted += `${(!address.address1 ? "" : address.address1 + "\n")}`
        address_formatted += `${(!address.address2 ? "" : address.address2 + "\n")}`
        address_formatted += `${address.city} ${address.postcode}\n`
        address_formatted += `${address.country}`

When printed in console it looks like that

firstname lastname
company
address1
address2
city postcode
country

here is my object

<AddressObject>
    <Name>Adresse</Name>
    <ForeColor Alpha="255" Red="0" Green="0" Blue="0" />
    <BackColor Alpha="0" Red="255" Green="255" Blue="255" />
    <LinkedObjectName />
    <Rotation>Rotation0</Rotation>
    <IsMirrored>False</IsMirrored>
    <IsVariable>True</IsVariable>
    <GroupID>-1</GroupID>
    <IsOutlined>False</IsOutlined>
    <HorizontalAlignment>Left</HorizontalAlignment>
    <VerticalAlignment>Top</VerticalAlignment>
    <TextFitMode>AlwaysFit</TextFitMode>
    <UseFullFontHeight>True</UseFullFontHeight>
    <Verticalized>False</Verticalized>
    <StyledText>
          <Element>
        <String xml:space="preserve">
            </String>
        <Attributes>
            <Font Family="Arial" Size="12" Bold="False" Italic="False" Underline="False" Strikeout="False" />
            <ForeColor Alpha="255" Red="0" Green="0" Blue="0" HueScale="100" />
        </Attributes>
          </Element>
        </StyledText>
    <ShowBarcodeFor9DigitZipOnly>False</ShowBarcodeFor9DigitZipOnly>
    <BarcodePosition>AboveAddress</BarcodePosition>
    <LineFonts>
        <Font Family="Arial" Size="12" Bold="False" Italic="False" Underline="False" Strikeout="False" />
        <Font Family="Arial" Size="12" Bold="False" Italic="False" Underline="False" Strikeout="False" />
    </LineFonts>
</AddressObject>

My problem is that when printing it, my newlines are ignored which makes my address unreadable, lines are messed up and scrambled I've tried with \r\n instead of \n with no noticeable changes. A printed address can look like this

address1citycodepostalcountry...

Any idea what could cause this ? And how I could fix it ?