Take the 2-minute tour ×
SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

I have created one application, which generates MS Word doc file.

For generating this I am using one data table which contains data. The first Column of the data table consist of Body and second is for Signature.

I am using Html Table dynamically for adding these column values.

After the body content and before the Signature, I want to add the Image of the User Signature.

And I placed this file to share point Images folder. But it's not rendering the images. Everything else works. My code:

tblLeter = new Table();
                trLetter = new TableRow();
                tdLetter = new TableCell();
                tdLetter.Controls.Add(new LiteralControl(Convert.ToString(dtLetter.Rows[0][Common.FieldInternalNames.Body])));
                trLetter.Controls.Add(tdLetter);
                tblLeter.Controls.Add(trLetter);

                trLetter = new TableRow();
                tdLetter = new TableCell();
                tdLetter.Controls.Add(new LiteralControl("<br /><br />Sincerely,<br /><br />"));
                trLetter.Controls.Add(tdLetter);
                tblLeter.Controls.Add(trLetter);

                trLetter = new TableRow();
                tdLetter = new TableCell();
                tdLetter.Controls.Add(new LiteralControl("<img src='" + objSiteConstants.ImageURL + "/_layouts/Images/Sign.JPG' alt=''/>"));
                trLetter.Controls.Add(tdLetter);
                tblLeter.Controls.Add(trLetter);

                trLetter = new TableRow();
                tdLetter = new TableCell();
                tdLetter.Controls.Add(new LiteralControl(Convert.ToString(dtLetter.Rows[0][Common.FieldInternalNames.Signature])));
                trLetter.Controls.Add(tdLetter);
                tblLeter.Controls.Add(trLetter);

                StringWriter sw = new StringWriter();
                HtmlTextWriter htw = new HtmlTextWriter(sw);

                tblLeter.RenderControl(htw);

                SPList objList = null;
                objList = spWeb.Lists[processing];
                SPListItem lstitem = objList.GetItemById(ID);
                spWeb.AllowUnsafeUpdates = true;
                if (lstitem != null)
                {

                    lstitem.Attachments.Add(AccountNumber + "_" + RuleCode + ".doc", new ASCIIEncoding().GetBytes(sw.ToString()));
                    lstitem.Update();
                }
                spWeb.AllowUnsafeUpdates = false;

What am I missing?

share|improve this question
    
The first thing I would do is load up fiddler or other trace tool and see what you sending/receiving. This should tell you pretty quickly if you need to adjust the request, alter ACL, etc. –  Jesus Shelby May 2 '13 at 14:06
add comment

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.