How to make top align in cfspreadsheet after merge cell using ColdFusion 10

620 Views Asked by At

I'm making a cell top align, after a merge cell by using spreadsheet functions. What I found on google and CFML Reference Adobe ColdFusion 10 was only left (default), right, center, justify, general, fill, and center_selection. Is there any other way or idea that can make it "top align" after merge cell? Here is my code :

<cfscript> 
    theSheet = SpreadsheetNew("Order Details 1");
    SpreadsheetAddRow(theSheet, "NO, ,VENDOR, PART NUMBER, PART NAME, PSI, LEAD TIME,MONTH, YEAR, ,N-5, N-4, N-3, 
    N-2, N-1, N, N+1, N+2, N+3, N+4, PACKING MONTH, PRODUCTION MONTH ",5,1); 
    myFormat2=StructNew();
    myFormat2.bold=false;
    myFormat2=StructNew();
    myFormat2.bold=false;
    myFormat2.alignment="vertical_top";
    SpreadsheetFormatRow(theSheet,myFormat2,6);
    SpreadsheetMergeCells(theSheet,6,25,2,2);
    SpreadsheetMergeCells(theSheet,6,25,3,3);
    SpreadsheetMergeCells(theSheet,6,25,4,4);
    SpreadsheetMergeCells(theSheet,6,25,5,5);
    SpreadsheetMergeCells(theSheet,6,25,7,7);
    SpreadsheetMergeCells(theSheet,26,45,2,2);
    SpreadsheetMergeCells(theSheet,26,45,3,3);
    SpreadsheetMergeCells(theSheet,26,45,4,4);
    SpreadsheetMergeCells(theSheet,26,45,5,5);
    SpreadsheetMergeCells(theSheet,26,45,7,7);
    SpreadsheetAddRows(theSheet,getROW);
</cfscript>
2

There are 2 best solutions below

9
rrk On BEST ANSWER

You can use verticalalignment instead/along with alignment for aligning to top. You can use vertical_top, vertical_bottom, vertical_center, vertical_justifyFor for different alignments.

For more information go here.

SpreadsheetFormatCellRange(theSheet,{verticalalignment="VERTICAL_TOP"}, 3,4,30,10);
0
Lance On

RRK answer should work but if you are looking for another option there is a plug-in that I have been using for a long time because of the limitations and frustrations of cfspreadsheet.

https://github.com/cfsimplicity/lucee-spreadsheet

I know its is really for Lucee (which I like better than Adobes version) but it does work in Adobe's CF2016 if you end up upgrading which you should be planning since ColdFusion 11 is hitting it's end of life this year.

https://helpx.adobe.com/support/programs/eol-matrix.html