【问题标题】:Putting subcells in cells dymo XML Javascript API将子单元格放入单元格 dymo XML Javascript API
【发布时间】:2014-08-23 15:42:54
【问题描述】:

我正在尝试使用 Javascript API 为连续标签制作 XML(我必须使用它们的单元格布局)。

这是我所拥有的:

<ContinuousLabel Version="8.0" Units="twips">
<PaperOrientation>Portrait</PaperOrientation>
<Id>Continuous</Id>
<PaperName>30270 Continuous</PaperName>
<LengthMode>Auto</LengthMode>
<LabelLength>0</LabelLength>
<RootCell>
<Length>0</Length>
<LengthMode>Auto</LengthMode>
<SubcellsOrientation>Vertical</SubcellsOrientation>
<Subcells>
<Cell>
<TextObject>
<Name>TEXT</Name>
<ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>
<BackColor Alpha="0" Red="255" Green="255" Blue="255"/>
<LinkedObjectName></LinkedObjectName>
<Rotation>Rotation0</Rotation>
<IsMirrored>False</IsMirrored>
<IsVariable>False</IsVariable>
<HorizontalAlignment>Center</HorizontalAlignment>
<VerticalAlignment>Middle</VerticalAlignment>
<TextFitMode>ShrinkToFit</TextFitMode>
<UseFullFontHeight>True</UseFullFontHeight>
<Verticalized>False</Verticalized>
<StyledText>
<Element>
<String>Hello World</String>
<Attributes>
<Font Family="Lucida Grande" Size="13" Bold="False" Italic="False" Underline="False" Strikeout="False"/>
<ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>
</Attributes>
</Element>
</StyledText>
</TextObject>
<Length>0</Length>
<LengthMode>Auto</LengthMode>
</Cell>
</SubCells>
</RootCell>
</ContinuousLabel>

我可以向子单元格标签添加更多单元格,但是我需要创建行和列(以及页眉和页脚)

他们的文档说根单元包含单元(子单元),单元可以包含标签对象或其他子单元 (他们的 xml 信息很少) 我找到了他们的 .net 框架文档,据我所知构建了 xml(如果您使用的是 .net),并且他们的 IContinuousLabelCell 有一个属性子单元格。但是我不知道如何将自己的子单元格添加到根单元格以外的单元格中。

这两天我一直在尝试解决这个问题,但我发现没有任何帮助。

所以你可以看到我想要完成的事情:http://jsfiddle.net/snymax/fu5hum81/22/

我已将不同的对象分解为函数,以使其在小提琴中更简单

我确信这会简单得多,然后我正在制作它,如果没有人知道另一种方法,我可以将自定义收据打印到 dymo labelwriter 450

【问题讨论】:

    标签: javascript xml dymo


    【解决方案1】:

    我找到了 dymo 的 xml 架构并弄清楚了

    RootCell 是一个具有特殊名称的 Cell 标签,它可以做任何普通 cell 可以做的事情,反之亦然。但是 RootCell 是 Continuouslabel 标签内的必需标签

    如果单元格要包含更多单元格,则它不能包含对象,其属性也必须位于子单元格标记之前

    如果单元格要包含对象,则它不能包含子单元格属性,并且必须在对象之后列出单元格属性

    这里有一个简单的例子

    var xml = '<ContinuousLabel Version="8.0" Units="twips">\
    <PaperOrientation>Portrait</PaperOrientation>\
    <Id>Continuous</Id>\
    <PaperName>30270 Continuous</PaperName>\
    <LengthMode>Auto</LengthMode>\
    <LabelLength>0</LabelLength>\
    <RootCell>\
    <Length>0</Length>\
    <LengthMode>Auto</LengthMode>\
    <BorderWidth>0</BorderWidth>\
    <BorderStyle>Solid</BorderStyle>\
    <BorderColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    <SubcellsOrientation>Vertical</SubcellsOrientation>\
    <Subcells>\
    '<Cell>\
    <Length>0</Length>\
    <LengthMode>Auto</LengthMode>\
    <BorderWidth>0</BorderWidth>\
    <BorderStyle>Solid</BorderStyle>\
    <BorderColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    <SubcellsOrientation>Horizontal</SubcellsOrientation>\
    <Subcells>\
    <Cell>\
    <TextObject>\
    <Name>QTY</Name>\
    <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    <BackColor Alpha="0" Red="255" Green="255" Blue="255"/>\
    <LinkedObjectName></LinkedObjectName>\
    <Rotation>Rotation0</Rotation>\
    <IsMirrored>False</IsMirrored>\
    <IsVariable>False</IsVariable>\
    <HorizontalAlignment>Center</HorizontalAlignment>\
    <VerticalAlignment>Middle</VerticalAlignment>\
    <TextFitMode>ShrinkToFit</TextFitMode>\
    <UseFullFontHeight>True</UseFullFontHeight>\
    <Verticalized>False</Verticalized>\
    <StyledText>\
    <Element>\
    <String>' + obj.qty + '</String>\
    <Attributes>\
    <Font Family="Lucida Grande" Size="13" Bold="False" Italic="False" Underline="False" Strikeout="False"/>\
    <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    </Attributes>\
    </Element>\
    </StyledText>\
    </TextObject>\
    <Length>0</Length>\
    <LengthMode>Auto</LengthMode>\
    <BorderWidth>0</BorderWidth>\
    <BorderStyle>Solid</BorderStyle>\
    <BorderColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    </Cell>\
    <Cell>\
    <TextObject>\
    <Name>NAME</Name>\
    <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    <BackColor Alpha="0" Red="255" Green="255" Blue="255"/>\
    <LinkedObjectName></LinkedObjectName>\
    <Rotation>Rotation0</Rotation>\
    <IsMirrored>False</IsMirrored>\
    <IsVariable>False</IsVariable>\
    <HorizontalAlignment>Center</HorizontalAlignment>\
    <VerticalAlignment>Middle</VerticalAlignment>\
    <TextFitMode>ShrinkToFit</TextFitMode>\
    <UseFullFontHeight>True</UseFullFontHeight>\
    <Verticalized>False</Verticalized>\
    <StyledText>\
    <Element>\
    <String>' + obj.name +'</String>\
    <Attributes>\
    <Font Family="Lucida Grande" Size="13" Bold="False" Italic="False" Underline="False" Strikeout="False"/>\
    <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    </Attributes>\
    </Element>\
    </StyledText>\
    </TextObject>\
    <Length>0</Length>\
    <LengthMode>Auto</LengthMode>\
    <BorderWidth>0</BorderWidth>\
    <BorderStyle>Solid</BorderStyle>\
    <BorderColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    </Cell>\
    <Cell>\
    <TextObject>\
    <Name>PRICE</Name>\
    <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    <BackColor Alpha="0" Red="255" Green="255" Blue="255"/>\
    <LinkedObjectName></LinkedObjectName>\
    <Rotation>Rotation0</Rotation>\
    <IsMirrored>False</IsMirrored>\
    <IsVariable>False</IsVariable>\
    <HorizontalAlignment>Center</HorizontalAlignment>\
    <VerticalAlignment>Middle</VerticalAlignment>\
    <TextFitMode>ShrinkToFit</TextFitMode>\
    <UseFullFontHeight>True</UseFullFontHeight>\
    <Verticalized>False</Verticalized>\
    <StyledText>\
    <Element>\
    <String>' + obj.price + '</String>\
    <Attributes>\
    <Font Family="Lucida Grande" Size="13" Bold="False" Italic="False" Underline="False" Strikeout="False"/>\
    <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    </Attributes>\
    </Element>\
    </StyledText>\
    </TextObject>\
    <Length>0</Length>\
    <LengthMode>Auto</LengthMode>\
    <BorderWidth>0</BorderWidth>\
    <BorderStyle>Solid</BorderStyle>\
    <BorderColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    </Cell>\
    </Subcells>\
    </Cell>';
    '<Cell>\
    <Length>0</Length>\
    <LengthMode>Auto</LengthMode>\
    <BorderWidth>0</BorderWidth>\
    <BorderStyle>Solid</BorderStyle>\
    <BorderColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    <SubcellsOrientation>Horizontal</SubcellsOrientation>\
    <Subcells>\
    <Cell>\
    <TextObject>\
    <Name>QTY</Name>\
    <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    <BackColor Alpha="0" Red="255" Green="255" Blue="255"/>\
    <LinkedObjectName></LinkedObjectName>\
    <Rotation>Rotation0</Rotation>\
    <IsMirrored>False</IsMirrored>\
    <IsVariable>False</IsVariable>\
    <HorizontalAlignment>Center</HorizontalAlignment>\
    <VerticalAlignment>Middle</VerticalAlignment>\
    <TextFitMode>ShrinkToFit</TextFitMode>\
    <UseFullFontHeight>True</UseFullFontHeight>\
    <Verticalized>False</Verticalized>\
    <StyledText>\
    <Element>\
    <String>' + obj.qty + '</String>\
    <Attributes>\
    <Font Family="Lucida Grande" Size="13" Bold="False" Italic="False" Underline="False" Strikeout="False"/>\
    <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    </Attributes>\
    </Element>\
    </StyledText>\
    </TextObject>\
    <Length>0</Length>\
    <LengthMode>Auto</LengthMode>\
    <BorderWidth>0</BorderWidth>\
    <BorderStyle>Solid</BorderStyle>\
    <BorderColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    </Cell>\
    <Cell>\
    <TextObject>\
    <Name>NAME</Name>\
    <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    <BackColor Alpha="0" Red="255" Green="255" Blue="255"/>\
    <LinkedObjectName></LinkedObjectName>\
    <Rotation>Rotation0</Rotation>\
    <IsMirrored>False</IsMirrored>\
    <IsVariable>False</IsVariable>\
    <HorizontalAlignment>Center</HorizontalAlignment>\
    <VerticalAlignment>Middle</VerticalAlignment>\
    <TextFitMode>ShrinkToFit</TextFitMode>\
    <UseFullFontHeight>True</UseFullFontHeight>\
    <Verticalized>False</Verticalized>\
    <StyledText>\
    <Element>\
    <String>' + obj.name +'</String>\
    <Attributes>\
    <Font Family="Lucida Grande" Size="13" Bold="False" Italic="False" Underline="False" Strikeout="False"/>\
    <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    </Attributes>\
    </Element>\
    </StyledText>\
    </TextObject>\
    <Length>0</Length>\
    <LengthMode>Auto</LengthMode>\
    <BorderWidth>0</BorderWidth>\
    <BorderStyle>Solid</BorderStyle>\
    <BorderColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    </Cell>\
    <Cell>\
    <TextObject>\
    <Name>PRICE</Name>\
    <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    <BackColor Alpha="0" Red="255" Green="255" Blue="255"/>\
    <LinkedObjectName></LinkedObjectName>\
    <Rotation>Rotation0</Rotation>\
    <IsMirrored>False</IsMirrored>\
    <IsVariable>False</IsVariable>\
    <HorizontalAlignment>Center</HorizontalAlignment>\
    <VerticalAlignment>Middle</VerticalAlignment>\
    <TextFitMode>ShrinkToFit</TextFitMode>\
    <UseFullFontHeight>True</UseFullFontHeight>\
    <Verticalized>False</Verticalized>\
    <StyledText>\
    <Element>\
    <String>' + obj.price + '</String>\
    <Attributes>\
    <Font Family="Lucida Grande" Size="13" Bold="False" Italic="False" Underline="False" Strikeout="False"/>\
    <ForeColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    </Attributes>\
    </Element>\
    </StyledText>\
    </TextObject>\
    <Length>0</Length>\
    <LengthMode>Auto</LengthMode>\
    <BorderWidth>0</BorderWidth>\
    <BorderStyle>Solid</BorderStyle>\
    <BorderColor Alpha="255" Red="0" Green="0" Blue="0"/>\
    </Cell>\
    </Subcells>\
    </Cell>';
    </Subcells>\
    </Cell>\
    </Subcells>\
    </RootCell>\
    </ContinuousLabel>'
    

    这显示了 2 行 3 列 我可能是唯一对该解决方案感兴趣的人,但我们发现 dymo 打印机比市场上的大多数其他打印机更便宜且更易于使用。

    只是为了让你们拥有其标签和连续标签的 xml 架构:http://www.labelwriter.com/software/dls/sdk/LabelFile.xsd

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-07-26
      • 1970-01-01
      • 1970-01-01
      • 2016-03-06
      • 1970-01-01
      • 2016-12-12
      • 1970-01-01
      相关资源
      最近更新 更多