<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://www.infopathdev.com:443/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>Code</title><link>https://www.infopathdev.com:443/forums/45.aspx</link><description /><dc:language>en</dc:language><generator>CommunityServer 2007 SP3 (Build: 31118.962)</generator><item><title>Re: How-To: insert images programmatically</title><link>https://www.infopathdev.com:443/forums/thread/14433.aspx</link><pubDate>Fri, 31 Mar 2006 06:07:04 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:14433</guid><dc:creator>Patrick Halstead</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/14433.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=14433</wfw:commentRss><description>Hi Anders,&lt;br /&gt;Most excellent post! You rock man! Keep it up!</description></item><item><title>How-To: insert images programmatically</title><link>https://www.infopathdev.com:443/forums/thread/12826.aspx</link><pubDate>Thu, 30 Mar 2006 07:28:56 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:12826</guid><dc:creator>AndersR</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/12826.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=12826</wfw:commentRss><description>Since it takes some quirks to make this work, i thought i'd post a 5 liner to show how to add pictures on the fly with managed code.&lt;br /&gt;&lt;br /&gt;In my example it was file attachments that needed to be converted to pictures for print view, but it could as well be a dropdown with with images in a Picture Library, folder or database, where you want to show the selected picture when selection changes.&lt;br /&gt;&lt;br /&gt;IXMLDOMNode picture = yourNodeList.selectSingleNode("my:picture");//this is where you want to put your picture. Could be a repeating list with a dummy picture object&lt;br /&gt;byte[] bytes = yourBinaryPicture;//this is a byte array containing the picture in binary format&lt;br /&gt;&lt;br /&gt;if ( ((IXMLDOMElement)picture).getAttribute("xsi:nil") != null )&lt;br /&gt;    ((IXMLDOMElement)picture).removeAttribute("xsi:nil");//remove attribute that specifies that the field has no value&lt;br /&gt;&lt;br /&gt;picture.nodeTypedValue = Convert.ToBase64String(yourBinaryPicture);//convert byte array to a Base64 encoded string and insert into nodeTypedValue property&lt;br /&gt;&lt;br /&gt;hope this saves some head scratching for someone :-)</description></item></channel></rss>