none
EnhMetafileBits property: bug in Word? RRS feed

  • Question

  • When I get the EnhMetafileBits property from a Range corresponding to a paragraph with list formatting (e.g. "2.1.3 Section title"), I get a picture which reads "1.1.1 Section title".  In other words the EnhMetafileBits does not accurately reproduce the appearance of the paragraph within the document.

    Is there any workaround?

    Friday, December 2, 2011 2:41 AM

Answers

All replies

  • Steps to reproduce the bug:

    In Visual Studio 2010 create a new VB.Net "Word 2010 document" project

    Edit the document contents to include the 3 paragraphs"Para 1", "Para 2", "Para 3".  Select the 3 paragraphs and apply a numbered list format.  The document contents should now read:

    1. Para 1
    2. Para 2
    3. Para 3

    In Solution Explorer, right click on "ThisDocument.vb", select "View code" and paste the following code:

    Imports System.Drawing.Imaging
    Imports System.IO
    
    Public Class ThisDocument
    
        Private Sub ThisDocument_Startup() Handles Me.Startup
            Dim frm As New Form
            frm.Height = 200
            frm.Width = 600
    
            Dim ctl As New PictureBox
            ctl.Image = New Metafile(New MemoryStream(DirectCast(Paragraphs(2).Range.EnhMetaFileBits, Byte())))
            ctl.Height = 200
            ctl.Width = 600
    
            frm.Controls.Add(ctl)
            frm.Show()
        End Sub
    
        Private Sub ThisDocument_Shutdown() Handles Me.Shutdown
    
        End Sub
    
    End Class
    
    

    Run the project: Word 2010 will start and you will see a window appear which reads "1. Para 2" !!!

    Sunday, December 4, 2011 10:48 PM
  • Hi Seb1732,

    Thank you for posting.

    I can reproduce the problem on my side. I also think this could be an issue. Thank you for your valuable feedback.You can submit this suggestion or feedback to Microsoft Connect feedback Center in formal format . Microsoft engineers will evaluate them seriously and report to corresponding Product Group.

    http://connect.microsoft.com/VisualStudio/

    In your feedback, you can quote the URL to this thread, so that the whole conversation can be available. Every feedback submitted will be evaluated carefully by our engineers. They will let you know their comments further through that portal. It would be great if you can also paste the link to the submitted feedback here, so that other community members can see it as well.
    Thank you for your valuable feedback again!
    Best regards,


    Bruce Song [MSFT]
    MSDN Community Support | Feedback to us
    Monday, December 5, 2011 8:53 AM
  • Bruce,

    Thank you for your reply.  I filed a bug report as you suggested: https://connect.microsoft.com/VisualStudio/feedback/details/711562/enhmetafilebits-property-bug-in-ms-word#details.

    Cheers,

    s.

    • Marked as answer by Bruce Song Tuesday, December 20, 2011 2:36 AM
    Monday, December 5, 2011 3:17 PM