I am trying to print Address label on dymo labelwriter 450 turbo
But the text is getting cutoff
I am using the below xml to format the text
function getAddressLabelXml()
{
var labelXml = '<?xml version="1.0" encoding="utf-8"?>\
<DieCutLabel Version="8.0" Units="twips">\
<PaperOrientation>Landscape</PaperOrientation>\
<Id>Address</Id>\
<PaperName>30252 Address</PaperName>\
<DrawCommands>\
<RoundRectangle X="0" Y="0" Width="1581" Height="5040" Rx="270" Ry="270" />\
</DrawCommands>\
<ObjectInfo>\
<AddressObject>\
<Name>Address</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>True</IsVariable>\
<HorizontalAlignment>Left</HorizontalAlignment>\
<VerticalAlignment>Middle</VerticalAlignment>\
<TextFitMode>ShrinkToFit</TextFitMode>\
<UseFullFontHeight>True</UseFullFontHeight>\
<Verticalized>False</Verticalized>\
<StyledText/>\
<ShowBarcodeFor9DigitZipOnly>False</ShowBarcodeFor9DigitZipOnly>\
<BarcodePosition>BelowAddress</BarcodePosition>\
<LineFonts/>\
</AddressObject>\
<Bounds X="332" Y="150" Width="4455" Height="1260" />\
</ObjectInfo>\
</DieCutLabel>';
return labelXml;
}
Depending on the length and height of the text, the text is either getting cutoff on the top or on the right
I am looking for a way to auto fit the text inside the label
Thanks in advance.
Change the TextFitMode value from 'ShrinkToFit' to 'AlwaysFit'
Related
Background: Jaspersoft studio 6.2
How to change forecolor of a text field based on an expression.
How can I apply a expression so the font color (forecolor) will be based on the value in that field? I can't find anywhere to set a expression for the forecolor property.
Maybe there is an option:
You need to set markup to style.
And then use an expression in the text field:
F{value1}=="GREEN"?$F{value1}:"<style backcolor='red'>"+$F{value1}+"</style>"
You can also add conditions and set multiple colors:
F{value1}=="GREEN"?"<style backcolor='green'>"+$F{value1}+"</style>":"<style backcolor='red'>"+$F{value1}+"</style>"
Maybe this will work for you.
Another possibility would be to use a style property expression in your textfield:
<textField ...>
<reportElement ...>
<propertyExpression name="net.sf.jasperreports.style.forecolor">
<![CDATA["#00FF00"]]>
</propertyExpression>
</reportElement>
...
</textField>
This setting will override the current forecolor attribute for the textfield, and a green text will be printed out.
Here are listed all dynamic style properties available for report elements.
You use conditionalStyle, to achieve this
Example
<style name="myStyle" forecolor="#0000FF">
<conditionalStyle>
<conditionExpression><![CDATA[$F{myField}<0]]></conditionExpression>
<style forecolor="#CC0000"/>
</conditionalStyle>
</style>
Then set the style to the textField when you like to use it
<textField>
<reportElement style="myStyle" x="448" y="5" width="100" height="20" uuid="b75e4497-e952-4051-8640-2f6b498dd152"/>
<textFieldExpression><![CDATA["Hello world"]]></textFieldExpression>
</textField>
In JasperSoft Studio, right click on style in outline to create "Conditional Style" and set the properties in the properties tab
<UserControl.DataContext>
<local:Model1 />
</UserControl.DataContext>
<Grid x:Name="LayoutRoot">
<telerik:RadTabControl Name="tab">
<telerik:RadTabItem x:Name="Tab0"
Height="30"
MinWidth="100"
Header="t1"
TabIndex="0">
<my:Control1 />
</telerik:RadTabItem>
<telerik:RadTabItem x:Name="Tab1"
Height="30"
MinWidth="100"
Header="t2"
TabIndex="1">
<my:Control2 />
</telerik:RadTabItem>
<telerik:RadTabItem x:Name="Tab2"
Height="30"
MinWidth="100"
Header="t3"
TabIndex="2">
<my:Control3 />
</telerik:RadTabItem>
</telerik:RadTabControl>
The following is my tabcontrol
All controls in Radtabitems are showing table whose data is from database.
All controls in Radtabitems have refresh function that use to refresh when date in database is refreshed.
The question is how can I refresh someone tab by itself after I do something in other tabs?
Please help me. Thanks.
<my:Control2 x:Name = "myControl1"/>
and use selectionchanged in your .cs
.cs
selectionchanged....
{
//if itemIndex = 1
Control2 temp = myControl1;
//some veiwing model...for example: ViewControl2
if(temp.Datacontext is ViewControl2)
{
ViewControl2 Viewtmp = temp.Datacontext as ViewControl2;
Viewtmp.Refresh();//your refresh function can create in Viewtmp
}
}
I want to make some text in a text field bold. I visited http://jasperreports.sourceforge.net/sample.reference/markup/index.html but could not get the desired result. I am using text field right now but when I tried using styled/html, the compilation failed. So can you help me with this jrxml code snippet:
<textField>
<reportElement x="200" y="10" width="590" height="42"/>
<textElement markup="styled"/>
<textFieldExpression><![CDATA["The static text without any format.\nThe field's data with bold format<style isBold='true'>:" + $F{TASKS_SUBTASK} + "</style>\n<style isBold='true' isItalic='true' isUnderline='true'>The static underlined text with bold and italic format</style>"]]></textFieldExpression>
</textField>
In this example: Style a text field in Jasper, the text field expression is wrong for which compilation fails.
Your help will be appreciated.
This work good:
"<style isBold='true' pdfFontName='Helvetica-Bold'>" + $F{data} + "</style>"
for input data from datasource, or
<style isBold="true" pdfFontName="Helvetica-Bold">Bolt text</style>
only for some static text.
For Text-field set properties Markup = styled.
in your view ireport designer.
click on the field and in the properties panel.: markup = styled selected
Right click on the fied. edit expression:
($F{fila1}.equals("c") ? "<style forecolor='red'>"+ $F{fila1}+"</style>" : $F{fila1})
or xml
<textFieldExpression><![CDATA[($F{fila1}.equals("c") ? "<style forecolor='red'>"+ $F{fila1}+"</style>" : $F{fila1})]]></textFieldExpression>
The <b> </b> tags no longer work on text fields. Make sure that 'Styled text' is enabled for the text field and put this in the field expression.
<style isBold="true" pdfFontName="Helvetica-Bold">Text to be bold...</style>
The pdfFontName can be whatever you like.
If you are making text bold that is already in a string be sure to escape the above quotes with a backslash.
I solved by putting for bold and underline in input string
"<b><u> your text</u></b>"
I solved this problem changing 'makup' text-field atribute to 'html'. Then in text-field expression use html tags like < b> < /b>. =D
"<style isBold='true' pdfFontName='Helvetica-Bold'>" + $F{data} + "</style>"
what is done above simply
<style isBold="true" pdfFontName="Helvetica-Bold">Bolt text</style>
For Text-field set properties Markup = styled.
see the screenshot below
hope this helps !!!
How do you add the "you are here" marker to the Bing Maps control? On the phone this is represented as a circle within a square and then there is an outer circle representing the location accuracy.
It looks like you could do it with a pushpin and a polgon but I'm hoping there is an easier/better way
You can use the GeoCoordinateWatcher class, which gives your current location, and then add a simple pushpin. I don't think the pushpin is a bad choice and/or a hard one to use.
GeoCoordinateWatcher watcher = new GeoCoordinateWatcher();
GeoCoordinate loc = watcher.Position.Location;
if (loc.IsUnknown == true)
{
// Cannot retrieve the GPS position
return;
}
MyBingMap.SetView(loc, 17);
MapLayer pushPinLayer = new MapLayer();
MyBingMap.Children.Add(pushPinLayer);
Pushpin p = new Pushpin();
p.Content = "YOU ARE HERE";
p.Location = loc;
pushPinLayer.AddChild(p, loc, PositionOrigin.BottomLeft);
You asked two questions and Tuco has given you a good answer to the first one: how to add the pushpin. Here's the answer to your second question: how to style it.
To get the pushpin to look like a yellow dot in a black diamond with a white nimbus, you need to define this style and apply it to the pushpin. I could also tell you how to style white numbers centred on a black circle with a white nimbus, but then I'd have to kill you.
xmlns:m="clr-namespace:Microsoft.Phone.Controls.Maps;assembly=Microsoft.Phone.Controls.Maps"
<Style x:Key="CurrentLocationPushpinStyle" TargetType="m:Pushpin">
<Setter Property="BorderBrush" Value="#FFF4F4F5" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<Rectangle Fill="Black" Height="25" Stroke="White" StrokeThickness="2" Width="25" RenderTransformOrigin="0.5,0.5">
<Rectangle.RenderTransform>
<CompositeTransform Rotation="45" TranslateX="-10" TranslateY="11"/>
</Rectangle.RenderTransform>
</Rectangle>
<Ellipse Fill="Yellow" Height="11" Stroke="Yellow" Width="11">
<Ellipse.RenderTransform>
<CompositeTransform TranslateX="-10" TranslateY="11"/>
</Ellipse.RenderTransform>
</Ellipse>
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
A yellow dot is soooo last year. Mango uses a blue dot.
Given an existing valid SVG document, what's the best way to create "informational popups", so that when you hover or click on certain elements (let's say ) you popup a box with an arbitrary amount (i.e. not just a single line tooltip) of extra information?
This should display correctly at least in Firefox and be invisible if the image was rasterized to a bitmap format.
This question was asked in 2008. SVG has improved rapidly in the intervening four years. Now tooltips are fully supported in all platforms I'm aware of. Use a <title> tag (not an attribute) and you will get a native tooltip.
Here are the docs:
https://developer.mozilla.org/en-US/docs/SVG/Element/title
<svg>
<text id="thingyouhoverover" x="50" y="35" font-size="14">Mouse over me!</text>
<text id="thepopup" x="250" y="100" font-size="30" fill="black" visibility="hidden">Change me
<set attributeName="visibility" from="hidden" to="visible" begin="thingyouhoverover.mouseover" end="thingyouhoverover.mouseout"/>
</text>
</svg>
Further explanation can be found here.
Since the <set> element doesn't work with Firefox 3, I think you have to use ECMAScript.
If you add the following script element into your SVG:
<script type="text/ecmascript"> <![CDATA[
function init(evt) {
if ( window.svgDocument == null ) {
// Define SGV
svgDocument = evt.target.ownerDocument;
}
tooltip = svgDocument.getElementById('tooltip');
}
function ShowTooltip(evt) {
// Put tooltip in the right position, change the text and make it visible
tooltip.setAttributeNS(null,"x",evt.clientX+10);
tooltip.setAttributeNS(null,"y",evt.clientY+30);
tooltip.firstChild.data = evt.target.getAttributeNS(null,"mouseovertext");
tooltip.setAttributeNS(null,"visibility","visible");
}
function HideTooltip(evt) {
tooltip.setAttributeNS(null,"visibility","hidden");
}
]]></script>
You need to add onload="init(evt)" into the SVG element to call the init() function.
Then, to the end of the SVG, add the tooltip text:
<text id="tooltip" x="0" y="0" visibility="hidden">Tooltip</text>
Finally, to each of the element that you want to have the mouseover function add:
onmousemove="ShowTooltip(evt)"
onmouseout="HideTooltip(evt)"
mouseovertext="Whatever text you want to show"
I've written a more detailed explanation with improved functionality at http://www.petercollingridge.co.uk/interactive-svg-components/tooltip
I haven't yet included multi-line tooltips, which would require multiple <tspan> elements and manual word wrapping.
This should work:
nodeEnter.append("svg:element")
.style("fill", function(d) { return d._children ? "lightsteelblue" : "#fff"; })
.append("svg:title")
.text(function(d) {return d.Name+"\n"+d.Age+"\n"+d.Dept;}); // It shows the tool tip box with item [Name,Age,Dept] and upend to the svg dynamicaly