Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 07-19-2024, 02:04 AM
arabgogs arabgogs is offline Converting tables to images - landscape issue. Windows 11 Converting tables to images - landscape issue. Office 2021
Novice
Converting tables to images - landscape issue.
 
Join Date: Jul 2024
Posts: 1
arabgogs is on a distinguished road
Default Converting tables to images - landscape issue.

Hi All,

I am attempting to convert all tables in a document to images, the code seems to work fine when the tables\pages are in portrait orientation. The issue of bottom rows being missing presents itself when landscape orientation has been applied.

There is a prepping process that unmerges cells and splits tables per individual page, where appropriate.

I have attempted many fix options, all to no avail. Code used below.

please note, when I comment out "tbl.PreferredWidth = 0" all rows display, however only half of the columns then display. This was an issue i had found previously. Pulling hair out!!

Code:
Sub ConvertTablesToImages(ByVal currentDoc As Word.Document)


     Dim tbl As Table, rng As Range, i As Integer
     Dim tWidth As Long, tHeight As Long
    
    For i = currentDoc.Tables.Count To 1 Step -1
        Set tbl = currentDoc.Tables(i)
        tbl.Select
        Set rng = tbl.Range
        'Get table width prior to resetting
        'tWidth = ReturnTableWidth(tbl)
        'tHeight = ReturnTableHeight(tbl)
        tbl.PreferredWidth = 0
        tbl.Range.CopyAsPicture
        
        rng.Collapse Direction:=wdCollapseStart
        'rng.Collapse Direction:=wdCollapseEnd
        
        tbl.Delete
        rng.PasteSpecial DataType:=wdPasteEnhancedMetafile
     
        'rng.ShapeRange(1).LockAspectRatio = msoFalse
        rng.ShapeRange(1).ConvertToInlineShape
    
        
    Next
End Sub



Any help appreciated.
Regards

Gordon
Reply With Quote
Reply

Tags
table conversion



Similar Threads
Thread Thread Starter Forum Replies Last Post
converting PPT 2016 to PDF - images does not come correctly Varun PowerPoint 0 10-17-2017 06:26 AM
Word issue Landscape/Portrait orientation Bearjew Word 5 06-09-2017 05:02 AM
Powerpoint is converting movies to images joezl PowerPoint 2 12-15-2014 04:01 AM
Converting tables to images - landscape issue. converting images/bitmaps to something editable docrob PowerPoint 1 09-26-2011 01:38 AM
Converting tables to images - landscape issue. Word 97, Landscape page orientation issue RodA Word 2 03-07-2011 04:51 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:56 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft