How to handle image not found exception in report? [duplicate] - image

This question already has answers here:
How to handle "Byte data not found"
(4 answers)
Hide image when its value is NULL or Empty in JasperReports
(2 answers)
How to show an image on jasper report?
(4 answers)
Closed 1 year ago.
I need to show an image in my report. It's showing correctly when the image is present in the path given in my image tag. But sometimes the image may not available in the location. In that case i'm getting image not found exception, instead i need to print blank.
My code to add image is
<image scaleImage="FillFrame" vAlign="Top" hAlign="Left" isUsingCache="false" evaluationTime="Now" hyperlinkType="None" hyperlinkTarget="Self" >
<reportElement
mode="Opaque"
x="18"
y="30"
width="125"
height="25"
forecolor="#000000"
backcolor="#FFFFFF"
key="image-1"
stretchType="NoStretch"
positionType="FixRelativeToTop"
isPrintRepeatedValues="true"
isRemoveLineWhenBlank="true"
isPrintInFirstWholeBand="false"
isPrintWhenDetailOverflows="false">
<printWhenExpression><![CDATA[new Boolean(!$P{signImagePath}.equals(""))]]></printWhenExpression>
</reportElement>
<box topBorder="None" topBorderColor="#000000" leftBorder="None" leftBorderColor="#000000" rightBorder="None" rightBorderColor="#FFFFFF" bottomBorder="None" bottomBorderColor="#000000"/>
<graphicElement stretchType="NoStretch" pen="None" fill="Solid" />
<imageExpression class="java.lang.String"><![CDATA[$P{signImagePath}+$F{USER_CODE}+".jpg"]]></imageExpression>

Related

Find image placed in Powerpoint 16 file's slide.xml file

So I have upzipped a Powerpoint 16 presentation and I am looking at the XML from a slide from the ppt/slides/ directory. I am searching for a reference to the image that is place on this slide, I THINK it is one of the <a:ext uri= references, but if it is I have no clue how to decode that URI into something readable. I just need the name of the image placed in the file. I am currently working on these files as text files mostly from the command line or using BBEdit.
<p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main"><p:cSld><p:spTree><p:nvGrpSpPr><p:cNvPr id="1" name=""/><p:cNvGrpSpPr/><p:nvPr/></p:nvGrpSpPr><p:grpSpPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/><a:chOff x="0" y="0"/><a:chExt cx="0" cy="0"/></a:xfrm></p:grpSpPr><p:sp><p:nvSpPr><p:cNvPr id="2" name="Title 1"><a:extLst><a:ext uri="{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}"><a16:creationId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" id="{B8809CFD-BA0C-B949-842F-AF9DC6782107}"/></a:ext></a:extLst></p:cNvPr><p:cNvSpPr><a:spLocks noGrp="1"/></p:cNvSpPr><p:nvPr><p:ph type="title"/></p:nvPr></p:nvSpPr><p:spPr><a:xfrm><a:off x="1425631" y="380758"/><a:ext cx="7103533" cy="927452"/></a:xfrm></p:spPr><p:txBody><a:bodyPr><a:noAutofit/></a:bodyPr><a:lstStyle/><a:p><a:r><a:rPr lang="en-US" dirty="0"/><a:t><Module Title></a:t></a:r></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="8" name="Rectangle 7" title="keystrokekeystrokekeystroke"><a:extLst><a:ext uri="{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}"><a16:creationId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" id="{2D7DBD16-C48C-A14E-A06C-D1FA8D4D56EB}"/></a:ext></a:extLst></p:cNvPr><p:cNvSpPr/><p:nvPr/></p:nvSpPr><p:spPr><a:xfrm><a:off x="1153056" y="1471353"/><a:ext cx="6837888" cy="4542163"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></p:spPr><p:style><a:lnRef idx="2"><a:schemeClr val="accent1"><a:shade val="50000"/></a:schemeClr></a:lnRef><a:fillRef idx="1"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="0"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="lt1"/></a:fontRef></p:style><p:txBody><a:bodyPr rtlCol="0" anchor="ctr"/><a:lstStyle/><a:p><a:pPr algn="ctr"/><a:r><a:rPr lang="en-US" dirty="0"/><a:t>Module Open Image</a:t></a:r></a:p></p:txBody></p:sp><p:sp><p:nvSpPr><p:cNvPr id="3" name="Shape_27"><a:extLst><a:ext uri="{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}"><a16:creationId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" id="{29E47EB4-A9BC-C843-A78D-94CF7CDCFA5D}"/></a:ext></a:extLst></p:cNvPr><p:cNvSpPr/><p:nvPr/></p:nvSpPr><p:spPr><a:xfrm><a:off x="1153056" y="1471353"/><a:ext cx="6837888" cy="4542163"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:blipFill><a:blip r:embed="rId2"/><a:stretch><a:fillRect/></a:stretch></a:blipFill></p:spPr><p:style><a:lnRef idx="2"><a:schemeClr val="accent1"><a:shade val="50000"/></a:schemeClr></a:lnRef><a:fillRef idx="1"><a:schemeClr val="accent1"/></a:fillRef><a:effectRef idx="0"><a:schemeClr val="accent1"/></a:effectRef><a:fontRef idx="minor"><a:schemeClr val="lt1"/></a:fontRef></p:style><p:txBody><a:bodyPr rtlCol="0" anchor="ctr"/><a:lstStyle/><a:p><a:pPr algn="ctr"/><a:endParaRPr lang="en-US"/></a:p></p:txBody></p:sp></p:spTree><p:extLst><p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}"><p14:creationId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="331219587"/></p:ext></p:extLst></p:cSld><p:clrMapOvr><a:masterClrMapping/></p:clrMapOvr></p:sld>
So am I close? Is it one of those URI's? If so, how do I decode it? If it is not one of those URI's then were would I find a reference to the slide on the file. I have done the obvious and searched the entire pptx zip file and have not found anything with .jpg in the text that references a file.
I realize this is a lot to ask in a single question, and for that I am sorry. I am just sort of lost at the moment.
For readable XML, look into a text editor like NotePad++, where you can prettify the text into indented lines.
There's no photo on this. There's a title "Module Title", a rectangle colored in Accent 1 with the text "Module Open Image", and another shape, also colored in Accent 1 but without text.
Here's what a slide with a picture looks like:
<p:sld xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:p="http://schemas.openxmlformats.org/presentationml/2006/main">
<p:cSld>
<p:spTree>
<p:nvGrpSpPr>
<p:cNvPr id="1" name=""/>
<p:cNvGrpSpPr/>
<p:nvPr/>
</p:nvGrpSpPr>
<p:grpSpPr>
<a:xfrm>
<a:off x="0" y="0"/>
<a:ext cx="0" cy="0"/>
<a:chOff x="0" y="0"/>
<a:chExt cx="0" cy="0"/>
</a:xfrm>
</p:grpSpPr>
<p:pic>
<p:nvPicPr>
<p:cNvPr id="5" name="Picture 4">
<a:extLst>
<a:ext uri="{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}">
<a16:creationId xmlns:a16="http://schemas.microsoft.com/office/drawing/2014/main" id="{0966E3E9-FCFA-4DDB-B218-46F441B47F87}"/>
</a:ext>
</a:extLst>
</p:cNvPr>
<p:cNvPicPr>
<a:picLocks noChangeAspect="1"/>
</p:cNvPicPr>
<p:nvPr/>
</p:nvPicPr>
<p:blipFill>
<a:blip r:embed="rId2"/>
<a:stretch>
<a:fillRect/>
</a:stretch>
</p:blipFill>
<p:spPr>
<a:xfrm>
<a:off x="4388972" y="1200719"/>
<a:ext cx="3414056" cy="4456562"/>
</a:xfrm>
<a:prstGeom prst="rect">
<a:avLst/>
</a:prstGeom>
</p:spPr>
</p:pic>
</p:spTree>
<p:extLst>
<p:ext uri="{BB962C8B-B14F-4D97-AF65-F5344CB8AC3E}">
<p14:creationId xmlns:p14="http://schemas.microsoft.com/office/powerpoint/2010/main" val="2510507612"/>
</p:ext>
</p:extLst>
</p:cSld>
<p:clrMapOvr>
<a:masterClrMapping/>
</p:clrMapOvr>
</p:sld>
The picture is not stored in the slide, it is only referenced. <a:blip r:embed="rId2"/> is the reference. Embedded photos are renamed and stored in the media folder. To find its format, you would check the slideX.xml.rels file (where X is the same slide number as the one you're checking) for rId2 to find that it is called image1.png inside the file.

Print Barcode type as 'code128' not scanning in odoo

I have created a Product Code with some criteria..
My Barcode lenth is around 26-30 characters..
I can print barcode properly but when scan/ read it not getting value..
My BarCode:
47789456789234/100001|417-19D
print_barcode.xml
<img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' %
('Code128', l.lot_id.name, 600, 100)"
style="width:300px;height:50px;" />
Can anyone help me to resolve this.
Try changing the Barcode format to EAN13 from Code128.
<img t-att-src="'/report/barcode/?type=%s&value=%s&width=%s&height=%s' %('EAN13', l.lot_id.name, 600, 100)" style="width:300px;height:50px;" />

how do i set an image in button win32 sdk [duplicate]

This question already has an answer here:
Win32: Unable to set Bitmap to Button
(1 answer)
Closed 7 years ago.
How do I set an image to a button in a new dialog box(DialogBox2) which opens after clicking a button in a dialog box(DialogBox1)
case WM_INITDIALOG:
hA1 = GetDlgItem(hDlg, IDD_SCORPIO);
hbitmap=LoadImage(GetModuleHandle(NULL),MAKEINTRESOURCE(IMG_BITMAPAries),IMAGE_BITMAP,0, 0, LR_DEFAULTCOLOR);
if(hbitmap==NULL)
MessageBox(hDlg,"load fail","Load",MB_OK);
else
MessageBox(hDlg,"load pass","Load",MB_OK);
if(SendMessage(hA1,BM_SETIMAGE,IMAGE_BITMAP,(LPARAM)hbitmap))
MessageBox(hDlg,"set pass","Set Image",MB_OK);
else
MessageBox(hDlg,"set fail","Set Image",MB_OK);
the bitmap loads but I am unable to set the image.
Set BS_BITMAP style for your button.

displaying a picture from a folder using a product name as a variable in actionscript

Hi I have a popup that displays a product details and I would like to display a picture from a folder which is named same as the product - so for example:
...
imageName = "pca" + this._product.productID;
...
My question is how can I display an image using imageName + .jpeg
Doing this works but I need to be able to substitute the image name by a variable - dynamically:
<mx:Image name="testImg" width="100%" height="100%" source="file:///C|/MultimediaSync/pictures/pca98694E000.jpg">
</mx:Image>
What I want to do instead is something like this but it doesn't work:
<mx:Image name="testImg" width="100%" height="100%" source="file:///C|/MultimediaSync/pictures/&imageName">
</mx:Image>
I am stuck on the syntaxt do this here...might be a simple one but I am a novice to as3/Flex
First define a class binding the image you need. Then the bitmap of the image can be retrieved, encoded (using an encoder) and assigned to the source property of mx.controls.Image instance.
After the formation of the image, it can be added to a canvas as a child. Alternatively, it should work if the source attribute is bound to the encoded data obtained from the class instance. I had the same problem and first solution worked for me. Following is my reference.
http://shyarmal.blogspot.com/2012/12/flex-displayable-image-from-image.html
Mark your imageName as Bindable:
[Bindable]
private var imageName:String;
and then use curly brackets{} in the source:
<mx:Image name="testImg" width="100%" height="100%"
source="file:///C|/MultimediaSync/pictures/{imageName}">
</mx:Image>
Whenever you will change imageName variable, the source will be updated respectively.
If Your Variable have Full Path Of Image, then You have To assign a Id to Image Like
<mx:Image **id="testImage"** name="testImg" width="100%" height="100%" source="file:///C|/MultimediaSync/pictures/&imageName">
</mx:Image>
[1] You can Assign A Image Like
testImage.Source=imageName;
and call every time when your imageName variable chagen.
[2] make sure your variable must be a [Binadable].
as per Above answer.
Hope Your Problem'll be solved...

date picker format wp7 showing time

I want to change my date picker format in windows phone 7. I have changed it to {0:dd-MM-yyyy}
but I still get both date and time in the string and also the preceding zeroes are omitted.
like if I want a date like 03-11-1988 all I get is 3/11/1988 00:00 AM.
how do I correct this ?
this is my xaml
<toolkit:DatePicker Margin="261,463,0,0" x:Name="datePicker1" HorizontalAlignment="Left" VerticalAlignment="Top" d:LayoutOverrides="VerticalAlignment" ValueStringFormat="{}{0:dd-MM-yyyy}" />
<toolkit:DatePicker HorizontalAlignment="Left" Margin="261,558,0,0" x:Name="datePicker2" Height="77" VerticalAlignment="Top" ValueStringFormat="{}{0:dd-MM-yyyy}" />
<toolkit:DatePicker HorizontalAlignment="Left" Margin="261,648,0,0" x:Name="datePicker3" VerticalAlignment="Top" ValueStringFormat="{}{0:dd-MM-yyyy}" />
I am talking about the value property.
The display in the selector is correct.The value property is returning string in the form like 3/12/2011 00:00 AM. although
String txtDate = Convert.ToString(txtDated.ToShortDateString());
removes 00:00AM but the date is still 3/12/2011 format and i want 03-12-2011 for which i think the only solution is replacing / with - in the string.

Resources