我正在尝试使用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>
我可以向子单元格标签添加更多单元格,但是我需要创建行和列(以及页眉和页脚)
他们的文档说rootcells包含单元格(子单元格),单元格可以包含标签对象或其他子单元格 (他们的xml信息非常少) 我发现他们的.net框架文档据我所知构建了xml(如果你使用的是.net),而他们的IContinuousLabelCell有一个属性子代理。但是我无法弄清楚如何将自己的子单元添加到根单元格以外的单元格中。
我一直试图解决这个问题两天了,我找不到任何帮助我的事。
所以你可以看到我想要完成的任务:http://jsfiddle.net/snymax/fu5hum81/22/
我已将不同的对象分解为函数,使其在小提琴中更简单
我确信这比我做的要简单得多,如果不是,有人知道另一种方法我可以将自定义收据打印到dymo标签450上
答案 0 :(得分:0)
我找到了dymo的xml架构并想出来了
RootCell是一个具有特殊名称的Cell标记,它可以执行正常单元格的任何操作,反之亦然。但RootCell是continuouslabel标记内的必需标记
如果单元格将包含更多单元格,它也不能包含对象,其属性也必须在Subcells标记之前
如果单元格将包含对象,则它不能包含子单元格属性,并且必须在对象后面列出单元格属性
所以这是一个快速的例子
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