I am working on displaying WORD documents and have a desktop application and a WEB Service that share the same code to create an image. In the desktop version it looks great. In the WEB version, the bitmaps being created have the lines in the table all messed up. I have attached a file as an example. It is a memo format in which the top part and some the other sections are tables. I have tried this with the 11.0 and 11.1 versions and the results are the same. My test environment is Windows 7, Visual Studio 2010, C# code. I have a licensed copy of the total package. I am running my WEB application from VS using the built-in WEB Server. The routine that creates the images and temporarily outputs the images is shown below. Is there something I need to do different in
public Image GetPageImage(int pageNumber, HighLightText[] highlightText)
{
try
{
if (msWordDocument != null && pageNumber > 0 && pageNumber <= numberOfPages)
{
PageInfo pageInfo = msWordDocument.GetPageInfo(pageNumber-1);
const float MyScale = 1.0f;
const float MyResolution = 200.0f;
Size pageSize = pageInfo.GetSizeInPixels(MyScale, MyResolution);
Bitmap img = new Bitmap(pageSize.Width, pageSize.Height);
img.SetResolution(MyResolution, MyResolution);
using (Graphics gr = Graphics.FromImage(img))
{
gr.TextRenderingHint = TextRenderingHint.AntiAliasGridFit;
gr.FillRectangle(Brushes.White, 0, 0, pageSize.Width, pageSize.Height);
msWordDocument.RenderToScale(pageNumber-1, gr, 0, 0, MyScale);
}
string bitmapFile = String.Format(@"c:\temp\PA{0}.bmp", Guid.NewGuid().ToString("N"));
img.Save(bitmapFile, ImageFormat.Bmp);
bitmapFile = String.Format(@"c:\temp\PA{0}.png", Guid.NewGuid().ToString("N"));
img.Save(bitmapFile, ImageFormat.Png);
return img;
}
}
catch (Exception ex)
{
LoggerProviderFactory.LoggerProvider.LogException(ex);
}
return null;
}
Thank you,
Jeff Ballance