<?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: Programmatic File Creation / Attachment</title><link>https://www.infopathdev.com:443/forums/thread/54645.aspx</link><pubDate>Fri, 07 May 2010 19:57:22 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:54645</guid><dc:creator>sjb_dev</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/54645.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=54645</wfw:commentRss><description>this line did it:

if (attachmentNode.MoveToAttribute(&amp;quot;nil&amp;quot;, http://www.w3.org/2001/XMLSchema-instance&amp;quot;)) { attachmentNode.DeleteSelf(); }</description></item><item><title>Re: Programmatic File Creation / Attachment</title><link>https://www.infopathdev.com:443/forums/thread/54644.aspx</link><pubDate>Fri, 07 May 2010 19:47:42 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:54644</guid><dc:creator>sjb_dev</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/54644.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=54644</wfw:commentRss><description>after a few more tests, my code works if i add an attachment manually to the file attachment field first, and then run my code against it.  the manually uploaded attachment is overwritten with my programmatically created xlsx file.  do i need to clear some value out of an empty file attachment control before programmatically setting the value?</description></item><item><title>Programmatic File Creation / Attachment</title><link>https://www.infopathdev.com:443/forums/thread/54643.aspx</link><pubDate>Fri, 07 May 2010 19:28:49 GMT</pubDate><guid isPermaLink="false">033a2e2d-04e2-4a9d-be01-a4634161eefd:54643</guid><dc:creator>sjb_dev</dc:creator><slash:comments>0</slash:comments><comments>https://www.infopathdev.com:443/forums/thread/54643.aspx</comments><wfw:commentRss>https://www.infopathdev.com:443/forums/commentrss.aspx?SectionID=45&amp;PostID=54643</wfw:commentRss><description>I&amp;#39;m creating a xlsx file utilizing the ExcelPackage object, and would like to set this byte[] as an attachment within my 2007 IP Browser Enabled form.  I&amp;#39;m creating the excel file and converting it to base64 before attachmentNode.setvalue(), but I keep getting the following error: Schema validation found non-data type errors.

Any ideas?

...
byte[] filedata = xlsxPkg.GetAsByteArray();
...
attachmentNode.SetValue(Convert.ToBase64String(filedata));</description></item></channel></rss>