Problem with OWC11 cells alignment from C#

U

Urotsukidoji

Hi,

I'm not sure if it's the proper forum to ask that but I haven't see
any more suitable.

I'm trying to use the Office 2003 Web Components into a C# applicatio
to display a simple report in a form. I added the COM spreadshee
object to the project an included it in a test form. Then I'm trying t
display the report in the spreadsheet.

The problem I currently have is, I've found no way to set th
horizontal alignment of a cell. When trying to use th
HorizontalAlignment property of the SpreadSheet.ActiveCell
SpreadSheet.Selection or Range objects, the compiler says me:
"D:\desarrollo\C#\Gespubli\Formularios\TestForm.cs(46): The languag
doesn't admit the property, the indexer or the even
'HorizontalAlignment'; try to call directly the methods with acces
descriptor 'OWC11._Range.get_HorizontalAlignment()'
'OWC11._Range.set_HorizontalAlignment(OWC11.XlHAlign)'"

The problem is, this methods doesn't exist... so I can't use them!

I have similar problems with cell colors, font properties, etc.

Can anybody give me a hint?

Here's the code:


Code
-------------------

// Get first worksheet
OWC11.Worksheetws = (OWC11.Worksheet)axSpreadsheet1.Worksheets[1];
// Set worksheet name
ws.Name = "Reportes";
// Get some cells from the first line
range = (OWC11.Range)ws.get_Range("A1","E1");
// Merge the cells
range.Merge(ref btmp);
// Select the merged cell
range.Select();
// Set the cell text
axSpreadsheet1.ActiveCell.set_Value(System.Type.Missing,"REGIONAL");
// Until here all works ok. But that doesn't work:
axSpreadsheet1.ActiveCell.HorizontalAlignment = OWC11.XlHAlign.xlHAlignCenter;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top