This project has moved and is read-only. For the latest updates, please go here.

Couple of feature requests

Dec 30, 2011 at 10:53 AM

1. Ability to set picture visibility (behind text, before text, etc). This way one could add a page number into footer over a picture (that's my need actually)

2. Sizing of charts. Right now they seem to come with standard size. I would like to be able to limit amount of space it needs (Height, Width).

Dec 30, 2011 at 5:35 PM
Edited Dec 30, 2011 at 5:36 PM

MadBoy,

I have had a look at your request "allow text to be placed on-top of images". Its a little bit messy but I am going to give it a try tomorrow.
Here is why it is messy.
Normally everything in a document is inline. This means that you never have to provide co-ordinates for anything and word decides how everything should be placed. When you decide to overlay things such as text and pictures, one of these things "the picture" has to be inserted into the document as a floating element i.e. not inline. This means it needs to have an anchor and relative horizontal and vertical co-cordinates.
This means that the code might end up writing code like this.
// Create a document.
using (DocX document = DocX.Create(@"C:\Users\cathal\Desktop\Test.docx"))
{
    // Add an Image to the document.
    Novacode.Image img = document.AddImage(@"C:\Users\cathal\Desktop\Test.jpg");
                
    // Create a picture from the Image.
    Picture pic = img.CreatePicture();
    pic.TextWrapping = TextWrapping.BehindText;
    pic.AbsoluteHorizontal = new AbsoluteHorizontal(1.72, TextWrappingHorizontal.Column);
    pic.AbsoluteVertical = new AbsoluteVertical(-0.8, TextWrappingVertical.Paragraph);
   
    // Add Footers to the document.
    document.AddFooters();
                
    // Get the default footer.
    Footer footer = document.Footers.odd;
                
    // Insert a Paragraph with some large, red text and our Picture;
    footer.InsertParagraph("Cathal Coffey").Color(Color.Red).FontSize(32).AppendPicture(pic);
    document.Save();
}
The code in bold is quite ugly. I need to think longer and harder how to make this better.
At the moment I am not happy with this solution.
Kind Regards,
Cathal
Dec 30, 2011 at 5:53 PM

Thanks for taking time to look into this.

Oct 21, 2014 at 1:21 PM
Was there ever a resolution for setting TextWrapping for a Picture?