繁体   English   中英

将子单元放入单元dymo XML Javascript API

[英]Putting subcells in cells dymo XML Javascript API

我正在尝试使用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>

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

他们的文档说rootcell包含单元格(子单元格),而cell可以包含标签对象或其他子单元格(它们的xml信息很少)我发现他们的.net框架文档据我所知构造了xml(如果您使用的是.net)及其IContinuousLabelCell具有属性子单元格。 但是我不知道如何将自己的子单元格添加到除根单元格之外的其他单元格中。

我已经尝试解决了两天,但没有发现对我有帮助。

因此,您可以看到我要完成的工作: http : //jsfiddle.net/snymax/fu5hum81/22/

我将不同的对象分解为函数,使它变得更简单了。

我敢肯定,这比我做的要简单得多,如果没有,那么没人知道我可以将定制收据打印到dymo标签印刷机上吗450

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

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM