web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Get column width and height from Excel cell

(0) ShareShare
ReportReport
Posted on by 180

Creating an Excel file from within AX X++. I am trying to figure out how I can capture the value that is in a cell or range of cells width and height? Thanks.

*This post is locked for comments

I have the same question (0)
  • LBP Profile Picture
    180 on at

    I have reviewed that and many others. They all refer to changing the values, I need to see the existing values. Not sure the syntax or if it is possible? Thanks for the help.

  • LBP Profile Picture
    180 on at

    Through AX X++ code I am trying to get the width value of a cell or range of cells on my Excel sheet. I want to capture the 8.43 value contained in the column width below.

    6153.Capture.JPG

  • Glenn Lissone Profile Picture
    927 on at

    Try this code:

        COM excel, wbs, wb, rng, sheets, sheet, cells, value, range, val, width;
     
        excel = new COM ('excel.application');
        wbs = excel.workbooks();
        wb = wbs.open(@"C:\test\test.xlsx");
        sheets = wb.worksheets();
        sheet = sheets.item(1);
        cells = sheet.cells();
        excel.visible(true);
     
        range =  cells.range("a1");
        val =  Range.value();   
        width = range.columnWidth();
       
        //set range properties
        range.value2(323);
        range.ColumnWidth(44); //width in points
        
        //read range properties     info(strFmt('%1, %2',  val.bStr(), width.double()));
  • LBP Profile Picture
    180 on at

    Thanks for your response. Sorry, I have not had time to try this solution.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Dráb Profile Picture

Martin Dráb 4 Most Valuable Professional

#1
Priya_K Profile Picture

Priya_K 4

#3
MyDynamicsNAV Profile Picture

MyDynamicsNAV 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans