Jump to content
Developer Wiki and Function Reference Links ×

Get Leader/Trailer returns NIL?


michaelk

Recommended Posts

Thanks, everyone, for your patience. I'd like to test your good graces a little further:

I'm working on a script where I need to get the leader and/or trailer on a number in a worksheet cell.

I can write a leader or trailer to a cell, but I can't read it. Does this have something to do with the leaders and trailers being truncated at 7 characters? Is the variable not really a string, but an array of characters?

I'll attach an example file. Select the cell and run the script.

I'll include the script for those not running 2012. I haven't tried previous versions- but in 2012, when a cell is formatted to have a leader and/or trailer the script does not picked up the string.

Unless I'm doing some truly boneheaded....

Thanks

MK

Procedure GetLeaderTrailer;

{Badly scripted by Michael Klaers}

VAR

WSHand : Handle; {Handle to Worksheet}

topRow,leftColumn,bottomRow,rightColumn,fontIndex,fontSize,fontStyle :INTEGER;

currentCellRow,currentCellColumn,topRangeRow,leftRangeColumn,topRangeSubrow,bottomRangeRow,rightRangeColumn,bottomRangeSubrow :INTEGER;

numStyle,numAccuracy : INTEGER;

currentLeaderString,currentTrailerString : STRING;

BEGIN {Main}

WSHand:=GetTopVisibleWS; {Get WORKSHEET cell range}

GetWSSelection(WSHand,currentCellRow,currentCellColumn,topRangeRow,leftRangeColumn,topRangeSubrow,bottomRangeRow,rightRangeColumn,bottomRangeSubrow);

GetWSCellNumberFormat(WSHand,currentCellRow,currentCellColumn,numStyle,numAccuracy,currentLeaderString,currentTrailerString);

Message( '||handle: ',WSHand,

' ||CurrentCellRow: ',currentCellRow,

' ||CurrentCellColumn: ',currentCellColumn,

' ||NumStyle: ',numStyle,

' ||NumAccuracy: ',numAccuracy,

' ||CurrentLeaderString: ',currentLeaderString,

' ||CurrentTrailerString: ',currentTrailerString);

END; {Main}

RUN(GetLeaderTrailer);

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...