Click here to Skip to main content
15,886,769 members

Comments by Darryl Bryk (Top 6 by date)

Darryl Bryk 10-Jan-23 22:03pm View    
This solution looks like it will search all the doc. parts for a text and replace it with another text. What I want to do is append a text string to the current footer in a template document. This should look something like this code below which adds a child paragraph to the main document, however, I need to add a child paragraph to the footer part.

private static void AddText(WordprocessingDocument doc, string text) {
Paragraph paragraph = doc.MainDocumentPart.Document.Body.AppendChild(new Paragraph());
Run run = paragraph.AppendChild(new Run());
run.AppendChild(new Text(text));
run.PrependChild(new RunProperties());
}
Darryl Bryk 2-Aug-20 16:28pm View    
Yes, Word will let the image be pasted into the page with auto re-sizing, but this doesn't allow me to make it have 2-3 images per pg. To do that I need to fit placeholders, like one above suggested, or re-size them by calculation, which is what I'm trying to do.

It seems to me that Microsoft would know how to break this info. out since it auto-resizes, so it knows how much space is left on the pg. I just need to know how to access the same info.
Darryl Bryk 30-Jul-20 20:42pm View    
I'd rather not rely on users that make templates determining the placement of images.
Darryl Bryk 30-Jul-20 20:41pm View    
Code to copy a graph:
using (MemoryStream mem = new MemoryStream()) {
cht.SaveImage(mem, ChartImageFormat.Bmp);
using (Bitmap bmp = new Bitmap(mem)) {
Clipboard.SetImage(bmp);
if (Clipboard.ContainsImage())
par.Range.Paste();
else throw new Exception("Clipboard.ContainsImage() failed");
}
}
Darryl Bryk 6-Jun-12 12:01pm View    
Are you trying to open a dialog window like MessageBox?