Hello Amjad,
I have a small trouble with the code im working on -
<cfset alignmentTechnical.putHorizontal(2)>
<cfset alignmentTechnical.putOrientation(-90)>
<cfset patternTechOrient.putPattern( 1 )>
<cfset patternTechOrient.putBackgroundColor(“13434879”)>
<cfset Top.putStyle( 1 )>
<cfset Left.putStyle( 1 )>
<cfset Right.putStyle( 1 )>
<cfset Bottom.putStyle( 1 )>
I need to apply the following code on the style above -
<cfset styleTechnical1.Apply()>
<cfset wksht.putLabel(7,7,“Technical”)>
<cfset wksht.putLabel(9,13,“WAvg”)>
<cfset styleTechnicalPercent.Apply()>
<cfset wksht.putFloat(8,7,“0.40”)>
<cfset wksht.putFloat(10,13,“1.0”)>
<cfset styleContextual1.Apply()>
<cfset wksht.putLabel(7,14,“Contextual”)>
<cfset wksht.putLabel(9,20,“WAvg”)>
<cfset styleContextualPercent.Apply()>
<cfset wksht.putFloat(8,14,“0.30”)>
<cfset wksht.putFloat(10,20,“1.0”)>
<cfset stylePersonal1.Apply()>
<cfset wksht.putLabel(7,21,“Personal”)>
<cfset wksht.putLabel(9,27,“WAvg”)>
<cfset stylePersonalPercent.Apply()>
<cfset wksht.putFloat(8,21,“0.10”)>
<cfset wksht.putFloat(10,27,“1.0”)>
<cfset styleLeadership1.Apply()>
<cfset wksht.putLabel(7,28,“Leadership”)>
<cfset wksht.putLabel(9,34,“WAvg”)>
<cfset styleLeadershipPercent.Apply()>
<cfset wksht.putFloat(8,28,“0.20”)>
<cfset wksht.putFloat(10,34,“1.0”)>
<cfset style1.Apply()>
i am able to work with aspose using this method which is -
<cfset style1 = CreateObject(“java”, “com.aspose.cells.Style”)>
<cfset wksht.getCells().hideColumn(16)>
<cfset cell.putValue(“Rev”)>
<cfset style1.getFont().setName(“Arial”)>
<cfset style1.getFont().setSize(“10”)>
<cfset style1.setPattern(BackgroundType.NONE)>
<cfset cell.setStyle(style1)>
but its a long method.
can you tell me a short method using aspose.
rachit:...............i am able to work with aspose using this method which is -
but its a long method.
can you tell me a short method using aspose.
Thanks for the reply Amjad, I think i must be more clear on my question.
My question is that can we define a style earlier just like the example i have given & then apply only cell number & cell value.
i gave you the example which contains the following code -
here every thing was defined earlier like - border, pattern, alignment, background color, with style named as - “styleTechnicalOrientation”.
then i only have to give the cell number & cell value & apply this to Style - (styleTechnicalOrientation).
like this one -
<cfset styleTechnicalOrientation.Apply()>
<cfset wksht.putLabel(7,7,“Technical”)>
<cfset wksht.putLabel(9,13,“WAvg”)>
<cfset styleTechnicalOrientation.Apply()>
<cfset wksht.putFloat(8,7,“0.40”)>
<cfset wksht.putFloat(10,13,“1.0”)>
here i only need to write - these lines & automatically is will be set to the style i have mentioned.
Hi,
<cfset cell.putValue(“Val1”)>
<cfset cell.setStyle(style1)>
<cfset cell.putValue(“Val2”)>
<cfset cell.setStyle(style1)>
<cfset cell.putValue(“Val3”)>
<cfset cell.setStyle(style1)>
int styleIndex = workbook.getStyles().add();
Style style = workbook.getStyles().get(styleIndex);
Hope this helps.
Thank you.