Search code examples
coldfusioncoldfusion-10cfspreadsheet

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


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>

Solution

  • 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);