.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

attach image/picture to rtf file

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :Windows Application
RtfTreeNode root = tree.RootNode; FaxOrderForm.AddFont(ref root); RtfTreeNode node = new RtfTreeNode(); RtfNodeCollection bkmk = root.SelectNodes("bkmkstart"); for (int i = 0; i < bkmk.Count; i++) { RtfTreeNode bkmkNode = bkmk[i].ParentNode; if (bkmkNode.PreviousSibling == null) bkmkNode = bkmkNode.ParentNode.PreviousSibling; else bkmkNode = bkmkNode.PreviousSibling; switch (bkmk[i].NextSibling.NodeKey) { case "AAA": bkmkNode.AppendChild(BuildGroupText(textboxA.Text.Trim())); break; } public static RtfTreeNode BuildGroupText(string str) { RtfTreeNode nodeGroup = new RtfTreeNode(RtfNodeType.Group); nodeGroup.AppendChild(new RtfTreeNode(RtfNodeType.Untouched, str, false, 0)); return nodeGroup; } I am now using RTFTreeNode to attach string to rtf file according to the remark name in rtf file but now i don't know how to attach a image/picture to rtf file (i have img file in the program folder that mean i can get the image by passing path) any example code for me c#

View Complete Post

More Related Resource Links

Rename Picture Library Image File Programmatically


Dear Experts and Forum Users,

I am stuck with renaming an image file type before it is actually saved to picture library. I am achieving this using a custom web part with file upload and a simple button control.

Please look at the code below (I have added comments so that it is easy for you to understand excactly what I am doing)

If FileUpload.HasFile Then
' Get extension of existing file
Dim ext as String = Path.GetExtension(FileUpload.PostedFile.FileName)
' Assign New Name - 'Test'
FileUpload.SaveAs(how to declare this path + "Test" + ext)
' Upload the Image to Picture Library
pictureLibraryList.RootFolder.Files.Add(FileUpload.FileName, streamImage)
' Finally Update the Picture Library
End If

Problems with this code

Firstly, it is not working because fileupload control method saveAs() and fileupload control method postedFile.saveAs() both require a rooted path in this case C:\inetput\images and not http:\\url\ some url pointing to picture library - how do I actually rename the file and also save it to the picture library ?

Please can you suggest a workaround for this.

Many Thanks,

how to make a css style background image be linked to an image in the resource file


hey guy, i need help in a very troubling matter. I want to make a textbox with a specific style, within this style a set of images as background parts, how can i attach these images to the custom control as whenever i take the .dll file and add it to the toolbar the images do not appear. So i tried to make them as resource files and their property as embedded in .resx file, so how to make the css style background image url to be linked to any of those image.

thanks in advance

Image file does not want to overwrite.


 I am having an issue with saving an image file to a temp file on the server after it is cropped.  I upload the image on one page and then modify it on another with the option to rotate or crop.  I have the crop feature set as a fixed size and am using JavaScript to accomplish this.  I am getting an error when I try to save the file as the original file name to overwrite it with the modified image file.  I know this has got to be something simple that I am overlooking, but I have been looking at it for a while and can't seem to spot the problem.  I currently have the image saved as "studentid_temp.jpg" in the temp folder.  I want to overwrite this file with the new cropped version of the photo.  Below is the code that i'm using, which gives me the error: A generic error occurred in GDI+.

When I change the file ending to something different (like studentid_temp1.jpg) the new cropped image saves without a problem because it does not have to overwrite the original. 

I have set the permissions on the folder to allow read/write functionality.

Any ideas to easily accomplish this overwrite?  I thought overwrite was kind of the default when a file came across with the same name, or is it because I still have the image open from the display (how would I fix that, if that's

Insert image into Infopath form and save to SharePoint as PDF file


I have an InfoPath web-enabled form in MOSS 2007, that is integrated with a K2 blackpoint process for an approval workflow.

Once the form (a Purchase Order request form) has been approved in the K2 workflow process, I switch the form view to a "print-friendly" view for the requestor to view from the browser.  However, now I need to go one step further with this scenario:

1) I need to somehow insert/embed an image with the scanned-in signature of the approver (likely stored in a SP doc library) at the signature line section of my form.  Also, what are the security requirements for storing such images, but not granting all users access to these (e.g. only services accounts that need to access this for embedding into the form, etc.)?

2) Then I need to convert this final "print-friendly" view of the form (with the signature image) to a PDF document so that I can store it in SharePoint (and email it to the requestor using K2's email event capabilities).

Can anyone help me with a solution to both of these requirement, or point me to some resources for this (even 3rd party components are open-game).



How to attach image with email in vb.net

i want to attach image with email in vb.net.

Unable to upload/attach any file

We have a developing Sharepoint server with SQL Seerver 2005 standard as a db server. Eventually server stopped to accept uploading any file into any library or attaching to any list item on all application poolls and site collections. What I've checked so far: server does have anough disk space.So any idea where else to look for somthing broken/corrupted?Here is the message we getting: The URL 'WebPartTesting/LOB1.xml' is invalid.  It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web.   at Microsoft.SharePoint.Library.SPRequestInternalClass.PutFile(String bstrUrl, String bstrWebRelativeUrl, Object varFile, PutFileOpt PutFileOpt, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String bstrCheckinComment, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage)    at Microsoft.SharePoint.Library.SPRequest.PutFile(String bstrUrl, String bstrWebRelativeUrl, Object varFile, PutFileOpt PutFileOpt, String bstrCreatedBy, String bstrModifiedBy, Int32 iCreatedByID, Int32 iModifiedByID, Object varTimeCreated, Object varTimeLastModified, Object varProperties, String bstrCheckinComment, UInt32& pdwVirusCheckStatus, String& pVirusCheckMessage) The problem appear

Saving Image File in a Folder on Sever from Client Machine using Sql Server

  Hi EveryOne... Can anyone help me Saving an Image file in a Server folder from a client machine using Sql server 2005....   

How to delete an image file assigned to a PictureBox xontrol ?

In a Windows form application, some image files are assigned to PictureBox controls. I am trying to delete those image files. The first approach [1] with "Image.FromFile" gives an error message of "Another process is using this image file", although "Image.Dispose()" is executed. The second approach [2] using "Image.FromStream" results (X) images for PictureBoxes and Buttons, if "fs.Close()" is inclided. Without "fs.Close()", it gives the same error message of "Another process is using...". How can I display images properly and delete those images files ? Thanks [1] pictureBoxSelected.Image = Image.FromFile(@actualImage); . . . pictureBoxSelected.Image.Dispose(); pictureBoxSelected.Image = Image.FromFile(@tempImage);                                                if (System.IO.File.Exists(actualImage) == true) {     System.IO.File.Delete(actualImage); } [2] FileStream fs = new FileStream(fileName, FileMode.Open, FileAccess.Read); pictureBox.Image = System.Drawing.Image.FromStream(fs); fs.Close();

WPF: can we reference a image file (~.png or ~.bmp) from a separated assembly?

We try to reference a image file (xxx.png) in a separated Reference assembly call "ResourceLibrary.dllwe have implement following code in another assembly (not main execuation assembly). <Button > <Image x:Name="pageUpArrow" Stretch="Uniform" Source="pack://application:,,,/ResourcesLibrary;component/Images/xxx.png" /> </Button> We get a complaint at run time:Message="Cannot convert string 'pack://application:,,,/ResourcesLibrary;component/Images/xxx.png' in attribute 'Source' to object of type 'System.Windows.Media.ImageSource'. Cannot locate resource 'images/xxx.png'.  Error at object 'System.Windows.Controls.ControlTemplate' in markup file ...Could we directly reference a image file (xxx.png) in saperated assembly?thanks!Jane

Upload image to database - couldn't find file path

I'm trying to display images in a GridView (yes, still this...). [edit] Before I can come to that I have to upload some images to the database.I've followed this tutorial for the "upload image to database" code (this worked fine for uploading images, but I don't know if the images were converted to byte):http://aspsnippets.com/Articles/Save-Files-to-SQL-Server-Database-using-FileUpload-Control.aspxand I've followed this tutorial for the "display images in gridview" code (and "retrieve file" from the tutorial below).http://www.aspsnippets.com/Articles/Display-images-from-SQL-Server-Database-in-ASP.Net-GridView-control.aspxIt doesn't quite work, the GridView shows but without imagesNow I'm trying to change the "save file" code according to this tutorial:http://aspsnippets.com/Articles/Save-and-Retrieve-Files-from-SQL-Server-Database-using-ASP.Net.aspxbut I don't understand everything in it. When I try to upload an image I get an error on this line:FileStream fs = new FileStream(filePath, FileMode.Open, FileAccess.Read); //couldn't find file (path to image I tried to upload) What should I do about it?

How to Set default file name of image in FileUpload Control

helloi want to set  default value in Fileupload control.Because when i select file name using fileupload then save that file to sqlserver database i got problem when no file is select. so i found alternate of that i should store default image into database through fileupload control but now my query is how to set default image to fileupload control.please i want source code.i really need it......tnx in advance

Accessing image file in local machine from server

 Hi i have a  .JPG file in my local machine which has  to be sent as body of SMTP mail. Path of image D://foldername//imagename.jpg The code I run is in the server m\c. I want it to access my local machine's d:\ folder to get the image file. But it is accessing the server m\c's d:\ folder. How can this be done? Thanks Amuda.RG  

Why is the "attach file" control not active, if I try to upload a file as an anonymous user within a

Hi everybody! We try to design an online application form and implement an infopath form over a form webpart! Meanwhile, I'm able to see the form as an anonymous user and I can enter the specific informations, but unfortunately I'm not able to attach a file, because the control is not aktive! Does someone have an idea, why?   Thanks for your replies    

how to attach sql database file to creating .exe setup in c#

I create a Setup file and put data folder, in data folder i put database file , but the problem is i have to mannualy attach database file in sql server 2005. I have to automatically attach database file when installing setup file.

Problem trying to attach database file to Microsoft SQL Server Management Studio

I was trying to attach a database to SQL Server MGT Studio and got an exception error.  The message stated that the database file I was trying to attach could not be opened because it was version 661.  The SQL Server shows to support version 655 and earlier.  It states that a downgrade path is not supported. Question:  Is there some download ; fix; I can make to SQL Server 2008 that will allow me to attach the version 661????  I am not technical at all.  Please speak slowly.  :)  Thanks

Attach File to Custom List

Hello - I need to use the Client Object Model to attach an item to a custom list item.  I have attachments enabled on the custom list.  The following code will upload a attachment to a list item ONLY if at least one attachment was added to the item via SharePoint. Dim credentials As New System.Net.NetworkCredential(MyUser, MyPassword, MyDomain) Dim SiteUrl As String = "http://spsandbox13" Dim clientContext As New ClientContext(SiteUrl) clientContext.Credentials = credentials '-- List item 41 hard coded for testing Dim attachmentPath As String = String.Format("/{0}/Lists/{1}/Attachments/{2}/{3}", "sites/ITS/GBPlayground", "FormConfiguration", "41", "SomeFileNameForMe7") Using fs As New FileStream("C:\Users\gbadmin\Documents\WhatsUp.txt", FileMode.Open) Microsoft.SharePoint.Client.File.SaveBinaryDirect(clientContext, attachmentPath, fs, True) End Using The above code works great as long as the item already has an attachment.  If the item doesn't have an attachment I get a (409): Conflict error.  I've also tried to create a folder in the attachments folder for the list item to see if once the folder was created that the error would go away.  The code for this is as follows: Dim list As Microsoft.SharePoint.Client.List = clientContext.Web.Lists.GetByTitle("

How to hide image in SharePoint 2007 picture library

We have a picture library which has users photos. I wanted to hide some of the users photos in the picture library. Is there any way available to achieve the same in SharePoint2007.   Thanks, Senthilrajan Kaliyaperumal
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend