SignatureLine in word document RRS feed

  • Question

  • Hello,
    I need to add a SignatureLine to my document and I'm using the following code:

    w.Paragraph p2 = new w.Paragraph();

    w.Run r2 = new w.Run();

    Bitmap image = new Bitmap(192, 96);
    Graphics g = Graphics.FromImage(image);
    Font f = new Font("Arial", 10, FontStyle.Regular);
    g.FillRectangle(Brushes.Red, new Rectangle(0, 0, 192, 96));
    MemoryStream stream = new MemoryStream();
    image.Save(stream, ImageFormat.Bmp);
    stream.Seek(0, SeekOrigin.Begin);

    ImagePart imagePart = doc.MainDocumentPart.AddImagePart(ImagePartType.Bmp);
    string imageId = doc.MainDocumentPart.GetIdOfPart(imagePart);

    w.Picture pict = new w.Picture();

    v.Shape shape = new v.Shape();
    shape.Style = "width:192px;height:96px";

    v.ImageData imageData = new v.ImageData();
    imageData.Title = "";
    imageData.RelationshipId = imageId;

    ovml.SignatureLine signatureLine = new ovml.SignatureLine();
    signatureLine.IsSignatureLine = ovml.BooleanValues.T;
    string signatureLineId = Guid.NewGuid().ToString();
    signatureLine.Id = signatureLineId;
    signatureLine.ProviderId = "{00000000-0000-0000-0000-000000000000}";
    signatureLine.SuggestedSigner = "Karel Borec";


    When I open a document, my image is not visible in signature line, only the image generated by word is visible.
    I do not understand what could be wrong...
    When I do not add any imagePart to the document and set imageData.RelationshipId to empty string, the document is incorect.
    On th other hand when I do not set imageData element, signature line is not visible.

    What should I set an image to the signature line if this image won’t be visible?


    Wednesday, September 16, 2009 9:11 AM