We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Need help for conveting code from introp to aspose

I am new in aspose . my code is using introp for excel and i have to convert into aspose. i am able to fond the suitable function in aspose. please provide the help on converting in aspose on below line of code.

Excel._Workbook workBook = null; Excel.Worksheet workSheet = null;Excel.Range cellRange = null; int priceCode = 0;

    try
    {
            

    //Open new work book                
    workBook = ExcelApp.Workbooks.Add(Type.Missing);
    // Get Reference to work sheet which is sheet 1
    workSheet =(Excel.Worksheet) workBook.Worksheets[1];

workSheet.Application.ReferenceStyle = Excel.XlReferenceStyle.xlA1;

    //        
    StringCollection headers = new StringCollection();
    headers.Add("Survey Date(MM/DD/YYYY)");
    headers.Add("Country ID");
    headers.Add("Country Name");</p><p>
    headers.Add("City ID");
    headers.Add("Item Id");
    headers.Add("Item Name");
    headers.Add("Currency");
    headers.Add("Low Price");
    headers.Add("Medium Price");
    headers.Add("High Price");
    headers.Add("Average");

     int asciiCode=65;
    int row = 1;
    for (int headersCount = 0; headersCount < headers.Count; headersCount++)
    {
    Char cellValue = Convert.ToChar(asciiCode);
    cellPosition = cellValue + row.ToString();
    ((Excel.Range)workSheet.get_Range(cellPosition, cellPosition)).Value2 = headers[headersCount];
    asciiCode++;
    }v</p>

Hi,


I am not entirely certain about your interop. code segment (I am not an expert of Excel automation APIs either) but it looks like you are inserting some data into different cells as headings and then insert the corresponding data into the concerned cells into the worksheet. We recommend you to kindly see the following documents with example code for your complete reference:
http://www.aspose.com/docs/display/cellsnet/Adding+Data+to+Cells
http://www.aspose.com/docs/display/cellsnet/Setting+Display+Formats+of+Numbers+and+Dates
http://www.aspose.com/docs/display/cellsnet/Named+Ranges
http://www.aspose.com/docs/display/cellsnet/Importing+Data+to+Worksheets


If you still have any confusion or issue while using Aspose.Cells APIs, kindly provide your simple expected file that you may manually create in Ms Excel with your dummy data related to your interop. code segment, we will check and help you on how to accomplish the task via Aspose.Cells APIs.

Thank you.