Cells merge operation

dear team

i would like to ask a question here. using aspose cells, how do we perform a cell merge operation. i need a thorough example as soon as possible. thank you


Hi,

Thanks for your question and interest in Aspose.Cells.
Please see this document if you are using .NET: Merging / UnMerging Cells in the Worksheet
OR
Please see this document if you are using Java: Merging / UnMerging Cells in the Worksheet

thank you merge operation is successfull now. but i am having trouble setting style to cells. here is the code that i use. even though i use a debugger to see that all values are correct. here is my code:

Style cellStyle = cell.GetStyle();
cellStyle.BackgroundColor = ColorTranslator.FromHtml(backColor);
cell.SetStyle(cellStyle);

above code doesnt work. even though value of backColor is Red and its type is System.Drawing.Color, it doesnt get applied after calling SetStyle function.

i tried below line but same result:
m_workBook.Worksheets[m_workSheetName].Cells[rowIndex, colIndex].SetStyle(cellStyle);

my code is doing the same thing that your previous post describes.

what do you think is the problem here?

Hi,

You should use ForegroundColor property so your code should be like this.

C#


Style cellStyle = cell.GetStyle();

cellStyle.ForegroundColor = ColorTranslator.FromHtml(backColor);

cell.SetStyle(cellStyle);


For more help, please refer to this document: Colors & Background Patterns

i am sorry to inform you this that foreground color property responded in the same manner.

code is as below:

Style cellStyle = cell.GetStyle();
cellStyle.ForegroundColor = ColorTranslator.FromHtml(backColor);
cell.SetStyle(cellStyle);
m_workBook.Worksheets[m_workSheetName].Cells[rowIndex, colIndex].SetStyle(cellStyle);

i cant seem to be able to pass further this point

please note that following code works

Style cellStyle = cell.GetStyle();
cellStyle.Pattern = BackgroundType.Solid;
cellStyle.ForegroundColor = ColorTranslator.FromHtml(backColor);
cell.SetStyle(cellStyle);

Hi,

Please check the following topic for your complete reference on how to set foreground and background colors with certain patterns types.
http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/colors-background-patterns.html

If you use foreground color, then you should specify certain pattern type e.g BackgroundType.Solid

Note: If you select BackgroundType.None value from the BackgroundType enumeration, forground color will not be applied whereas background color is not applied if you select BackgroundType.None or BackgroundType.Solid value.


Thank you.


thank you. i have checked out the document and completed my excel export functionality. there is just one message i get with file type .xls
this message appears when i click the save button on excel. here is the message below. i am wondering if there is a way to avoid this message popping up since it is able to convert the unsupported formats to closest formats available. thank you


Compatibility Report for May302011ProblematicReloadDefin (3).xls





Run on 6/15/2011 10:46












The following features in this workbook are not supported by earlier versions of Excel. These features may be lost or degraded when you save this workbook in an earlier file format.












Minor loss of fidelity

# of occurrences









Some cells or styles in this workbook contain formatting that is not supported by the selected file format. These formats will be converted to the closest format available. 2


Hi,


Can you share what version of Excel you are using?
This message pops up when your workbook has some features that are not supported in previous versions of Excel and you try to save it in a prior format. Examples can be many, but right now your Excel is pointing to some formatting that isn’t supported in XLS format. You are saving the workbook in Excel 97-2003 format and Excel is telling you that it has converted some cell formats to the closest that it can achieve in that format. If you save the same workbook in XLSX format then there will be no problem in doing so.
Please read for the Compatibility Checker option in MS Excel 2007.