0

我正在尝试使用 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 有一个属性 subcells。但是我无法弄清楚如何将我自己的子单元格添加到根单元格以外的单元格中。

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

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

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

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

4

1 回答 1

0

我找到了 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

于 2014-08-23T18:04:46.927 回答