簡體   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