Free Support Forum - aspose.com

Problem with Method ImportTwoDimensionArray()

I am trying to use the method mentioned, but according to our view, we are producing this unintended effect, I am enclosing a sample project, as an image format expected, we expect compliments your comments,
Here is a picture of how you should file according to leave us,

Hi,

Well, you need to add a line of code to display your text completely.

e.g..,

WS.Worksheets[0].Cells.ImportTwoDimensionArray(DoubleArray, 6,3);

WS.Worksheets[0].AutoFitColumn(3);
WS.Worksheets.ActiveSheetIndex = 0;

Thank you.

Hi,

And if you don't want to autofit cells in the columns and you just want to auto-span other cells if a cell's value is long, you may try to modify your code and it will work fine:

e.g.(you just need to declare your array variable for your data as)

var DoubleArray = new object[2,1];

Actually we treat null values as "" for Cells.ImportTwoDimensionArray() and that caused the two lines not to display properly. Any how, you may try the above option for the time being and we will figure it out soon.

Thank you.

Dear Amjad,

Just do not want to use the method "AutoFitcolums ()" because I want to generate a report such as the one in this picture attached, there is some way to build it, I hope your comments,

Best regards,

Hi,

Did you read my previous reply, I repeat it here again.

If you don't want to autofit cells in the columns and you just want to auto-span other cells if a cell's value is long, you may try to modify your code and it will work fine:

e.g.(you just need to declare your array variable based on your no. of your data (rows and columns)

//if you have 2 values (2 rows and 1 columns), you may declare your array as.

var DoubleArray = new object[2,1];

Actually we treat null values as "" for Cells.ImportTwoDimensionArray() and that caused the two lines not to display properly. Any how, you may try the above option for the time being and we will figure it out soon.

Thank you.

The problem is that the array is dynamic, and when using this function apparently importing any character or giving format to cells that do not contain anything, I found a solution, which involves import of cells rather than just arrangements so whatever objects that contain some value, is a little slower, but the goal is met,

Thanks,

Hi,

Thanks for your patience.

Please try this fix.

In this fix,We use Cell.GetStyle and SetStyle method replace the property of Cell.Style.

If you want to set style of the cell, please change your codes as :

//Getting the style of the cell.

Style style = cell.GetStyle();

//Setting the property of the style.

.......

//Setting the style of the cell

cell.SetStyle(style);