Migration to Aspose.Cells 7 (2)

I would like to continue :

Migration to Aspose.Cells 7 from Aspose.Cells 2.5.4.202

as I can see:
chart.getNSeries().add(“A1:B4”, true);
can you explain boolean variable - true? what is it ? isVertical?? Mean?

Can I re-write this code:
Series s1 = nSeries.get( nSeries.add() );
s1.setName( “a” );
s1.setValues( “B1” );
->>> to these:

int nSNum = nSeries.add( “B1”, true );
Series s1 = nSeries.get( nSNum );
s1.setName( “a” );
???



Hi again,


I have not understood answer:
Migration to Aspose.Cells 7 from Aspose.Cells 2.5.4.202

previously I have used such code: ( now it is not working for me )
com.aspose.cells.Chart aChart = charts.addChart( ChartType.COLUMN,
1,
2,
3,
4,
5,
6 );

now it is not working, but now we need to use: How I can change it in order to make it working ?
int chartIndex = sheet.getCharts().add(ChartType.COLUMN, 9, 9, 21, 15);
this is only one way to create chart now?


Hi,


previously I have used:
cells.setRangeStyle( 4, 6, 1, 2, style );


how I can make it with Cells 7?

Hi just to be sure:

this is correct replacment?:

new Color( color.getRed(),color.getGreen(), color.getBlue() ) ); // Previous
->>>>>>> to
Color.fromArgb( color.getRed(), color.getGreen(), color.getBlue() ); // Cells 7
???
Hi,

alg:

1)
previously:
ImageOptions imageOptions = new ImageOptions();
imageOptions.setImageFormat( ImageFormat.PNG );
imageOptions.setFashion( FileFormatType.EXCEL97TO2003 );

How I can set setFashion now?
IS this correct????
imageOptions.setSaveFormat( SaveFormat.EXCEL_97_TO_2003 );


Well, you don't really need to set fashion / saving file format in the new version as by default it is Excel 2003 oriented if the file is XLS. And your understanding is correct.

alg:
2)
Title title = chart.getTitle();
Font font = new Font(); - how I can make a Font ????
title.setFont( font ); - how I can set Font ???

See the sample code.

Title tile = chart.getTitle();
Font font = title.getTextFont();
//Now use the methods of the Font class for your needs
......
//No, need to set the font object back to title now, it is automatically set.

alg:
3) Please, can you ask on this question:
https://forum.aspose.com/t/122578

as I can see:
chart.getNSeries().add("A1:B4", true);
can you explain boolean variable - true? what is it ? isVertical?? Mean?

Can I re-write this code:
Series s1 = nSeries.get( nSeries.add() );
s1.setName( "a" );
s1.setValues( "B1" );
->>> to these:

int nSNum = nSeries.add( "B1", true );
Series s1 = nSeries.get( nSNum );
s1.setName( "a" );
????


The isVertical parameter denotes whether to specify the data source row wise or column wise. For example if your source data is in rectangular shape, e.g A1:B10, A1:A10, A1:C10 etc., then you may use to set it by vertically--> set the isVertical to "true". If your data source (for the series) is spanned on a row, e.g A2:G2, you may set "isVertical" to "false" accordingly. I think for better understanding, you may exercise by yourself by setting "true" and "false" for a single data source (for the data series). For more information an complete reference, check the API Reference for these APIs set to see the examples and details/instructions about the parameters.

alg:
I would like to continue :
https://forum.aspose.com/t/122578#335041

as I can see:
chart.getNSeries().add("A1:B4", true);
can you explain boolean variable - true? what is it ? isVertical?? Mean?

Can I re-write this code:
Series s1 = nSeries.get( nSeries.add() );
s1.setName( "a" );
s1.setValues( "B1" );
->>> to these:

int nSNum = nSeries.add( "B1", true );
Series s1 = nSeries.get( nSNum );
s1.setName( "a" );
????





1-
Yes, you are right.

2-
It seems, chart.getTitle().setTextFont() is missing. Although, it is present in .NET version. We will implement it soon.

3-
This flag determines, how series values will be taken, for example you specify A1:B3

Now, you see horizontally, there are 3 series

i.e
A1, B1
A2,B2
A3,B3

and vertically, there are 2 series
A1, A2, A3
B1, B2, B3
Hi,

alg:
I have not understood answer:
https://forum.aspose.com/t/122578

previously I have used such code: ( now it is not working for me )
com.aspose.cells.Chart aChart = charts.addChart( ChartType.COLUMN,
1,
2,
3,
4,
5,
6 );

now it is not working, but now we need to use: How I can change it in order to make it working ?
int chartIndex = sheet.getCharts().add(ChartType.COLUMN, 9, 9, 21, 15);
this is only one way to create chart now?



Well, I asked you that you should add a chart normally as mentioned by your above line of code. Then get the ChartShape using chart.getChartObject() method, now you may specify your desired attributes using different methods of ChartShape class accordingly.
e.g

int chartIndex = sheet.getCharts().add(ChartType.COLUMN, 9, 9, 21, 15);
Chart chart = sheet.getCharts().get(chartIndex);
ChartShape cshape = chart.getChartObject();

//...........Now use and set your desired attributes.

Thank you.

Hi,

alg:
Hi,

previously I have used:
cells.setRangeStyle( 4, 6, 1, 2, style );


how I can make it with Cells 7?

Please create a Range object as per your desired area. Now, create Style object with your desired style formatting. Lastly, use Range.setStyle() method for your need.

Hi,

alg:
Hi just to be sure:
this is correct replacment?:

new Color( color.getRed(),color.getGreen(), color.getBlue() ) ); // Previous
->>>>>>> to
Color.fromArgb( color.getRed(), color.getGreen(), color.getBlue() ); // Cells 7
???

Your are right.
1.
Title title = chart.getTitle();
Font font = new Font(); - how I can make a Font ????
title.setFont( font ); - how I can set Font ???
Well, you can use Title.getTextFont() to get a Font object and then setting its properties. Because this Font object belongs to the specific Title object, modification of the font will effect the title directly. So there is no need for method Title.setTextFont().
2.
new Color( color.getRed(),color.getGreen(), color.getBlue() ) ); // Previous
->>>>>>> to
Color.fromArgb( color.getRed(), color.getGreen(), color.getBlue() ); // Cells 7
???
Methods of Color.getRed()/getGreen()/getBlue() in V7 will return one Color object represents the pre-defined RED/GREEN/BLUE color. There are also many other such kind of methods for user’s convenience to get pre-defined colors, such as Color.getAliceBlue(), Color.getBlack(), ...etc.
The corresponding methods for Color.getRed()/Color.getGreen()/Color.getBlue() of old versions is Color.getR()/getG()/getB(), so the method corresponds with new Color(color.getRed(), color.getGreen(), color.getBlue()) now should be Color.fromArgb(color.getR(), color.getG(), color.getB()) for versions from V7.
Hello,

Thank you for your quick correct answers.
This is realy huge help for me.

also how I can set this property now?
a) picture.setHasLine( true ); ???
b) picture.setPositionXY ???
c) picture.setLeftPositionInPixel


I have noticed that now many method start to throw general exceptions.
For example:
public com.aspose.cells.Picture addPicture(int i, int i1, java.io.InputStream inputStream, int i2, int i3) throws java.lang.Exception { /* compiled code */ }
Previously I have not have any catch for this method?
Can you exaplain why?

Amjad Sahi:
Hi,

alg:
Hi,

previously I have used:
cells.setRangeStyle( 4, 6, 1, 2, style );


how I can make it with Cells 7?

Please create a Range object as per your desired area. Now, create Style object with your desired style formatting. Lastly, use Range.setStyle() method for your need.


It is not possible to create Range object for me directly:
RangeCollection rangeCollection = new RangeCollection();
Range range = new Range();
Contructors are not public , and not accessible from outside of package.
Can you give me code-example?

Hi,

alg:

It is not possible to create Range object for me directly:
RangeCollection rangeCollection = new RangeCollection();
Range range = new Range();
Contructors are not public , and not accessible from outside of package.
Can you give me code-example?


See the document on how to create ranges:
http://www.aspose.com/documentation/java-components/aspose.cells-for-java/named-ranges.html

Thank you.

Hi,


How can I set Auto property
ChartArea chartarea = chart.getChartArea();
chartarea.getArea().setAuto( false );
and
chartarea.getArea().setAuto( true ); ??


Previously I can make:


charts[0] = worksheet.getCharts().addChart(ChartType.COLUMN_3_D_STACKED, 5, 0, 0, 0, 400, 300 );
charts[1] = worksheet.getCharts().addChart(ChartType.COLUMN_3_D_STACKED, 5, 7, 0, 0, 400, 300 );

But now I need to make the following:
int chartIndex1 = chartCollection.add( ChartType.COLUMN_3_D_STACKED, 5, 0, 0, 0);
int chartIndex2 = chartCollection.add( ChartType.COLUMN_3_D_STACKED, 5, 7, 0, 0);
charts[0] = chartCollection.get( chartIndex1 );
charts[1] = chartCollection.get( chartIndex2 );

charts[0].getChartObject().setWidth( 400 );
charts[0].getChartObject().setHeight( 300 );
charts[1].getChartObject().setWidth( 400 );
charts[1].getChartObject().setHeight( 300 );

Can I make it a lttile bit more simple? especcialy with ChartObject.

Hi,

alg:

How can I set Auto property
ChartArea chartarea = chart.getChartArea();
chartarea.getArea().setAuto( false );
and
chartarea.getArea().setAuto( true ); ??


I think you may try accordingly using the new APIs set:
e.g
chartarea.getArea().setFormatting(FormattingType.NONE/AUTOMATIC/CUSTOM);

Thank you.

Hi,

alg:
Previously I can make:

charts[0] = worksheet.getCharts().addChart(ChartType.COLUMN_3_D_STACKED, 5, 0, 0, 0, 400, 300 );
charts[1] = worksheet.getCharts().addChart(ChartType.COLUMN_3_D_STACKED, 5, 7, 0, 0, 400, 300 );

But now I need to make the following:
int chartIndex1 = chartCollection.add( ChartType.COLUMN_3_D_STACKED, 5, 0, 0, 0);
int chartIndex2 = chartCollection.add( ChartType.COLUMN_3_D_STACKED, 5, 7, 0, 0);
charts[0] = chartCollection.get( chartIndex1 );
charts[1] = chartCollection.get( chartIndex2 );

charts[0].getChartObject().setWidth( 400 );
charts[0].getChartObject().setHeight( 300 );
charts[1].getChartObject().setWidth( 400 );
charts[1].getChartObject().setHeight( 300 );

Can I make it a lttile bit more simple? especcialy with ChartObject.


Well, I am afraid you have to do it now in order to accomplish the task. These APIs e.g ChartShape is equally matched with .NET version's class which has the same attributes/properties as these are in Java version.

Thank you.

Hi,

For your questions:

1. picture.setHasLine( true );
Please use
picture.getLineFormat().setVisible(true);

2. picture.setPositionXY(x, y);
Please use
picture.setX(x);
picture.setY(y);

3. picture.setLeftPositionInPixel(column, pixels);
Please use
picture.setUpperLeftColumn(column);
picture.setLeft(pixels);

Hi,

Previously I can make the following:
TextBox textBox = worksheet.getShapes().addTextBox( 10,10,10,10,10,10 );
How I can make it now?

also previously I were able to set these properties:
textBox.setFilled( false );
textBox.getLine().setVisible( false );
textBox.setContent( title );
how I can make it now?
maybe textBox.setContent -> textBox.setText this is correct?


Hi,

previously I can make the following:
PageSetup pageSetup = worksheet.getPageSetup();
pageSetup.setLeftHeader( header );
pageSetup.setDifferentFirstPage( true );
pageSetup.setsetCenterFooter( footer );

How I can make it now?
maybe: pageSetup.setDifferentFirstPage( true );
>>>>> pageSetupsetHFDiffFirst( true );