I want the markers check the type of data stored in column and format the value accordingly.

Last post 02-02-2011, 5:20 AM by Amjad Sahi. 1 replies.
Sort Posts: Previous Next
  •  02-02-2011, 4:24 AM 282462

    I want the markers check the type of data stored in column and format the value accordingly. .NET

    Hi,
    I'm creating columns and rows value using smart marker adding the date from data table. When i adding the data to the sheet with the help of smart markers i need the markers check the type of data stored in column and format the value accordingly. as in excel.

    Thanks,
    Sridhar.S
     
  •  02-02-2011, 5:20 AM 282480 in reply to 282462

    Re: I want the markers check the type of data stored in column and format the value accordingly.

    Hi,

    Well, there are two major data types that MS Excel does store data in numeric/numbers and strings values. For date type, MS Excel does store date in numeric values. If a pure number is inserted/filled into a cell, Ms Excel does convert it to numeric value automatically else it (alpha numeric or text) will be stored in string values.

    1) For numeric conversion, you may try to use "numeric" parameter while defining markers in the template worksheet cells. e.g

    &=Table1.Field1(numeric)

    This way, Aspose.Cells will try to convert text to number if possible.

    2) For date columns, since the dates are stored in numeric values, so you need to format the date columns by yourself according to your desired Date format. For example, after processing the smart markers and when the data is filled with your date values, you may format the column/cells/ or range to your desired date formats, see the sample code below:
    //...............
    Aspose.Cells.Style style = null;
                StyleFlag flag = null;
                flag = new StyleFlag();
                style = wb.Styles[wb.Styles.Add()];
                style.Custom = "mm/dd/yyyy";
                flag.NumberFormat = true;
    //Apply the custom date formatting style to first column
    ws.Cells.ApplyColumnStyle(0, style, flag);
    //............

    See further reference about formatting a complete row/column etc.:
    http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/formatting-rows-columns.html

    For complete reference about Smart markers, see the document:
    http://www.aspose.com/documentation/.net-components/aspose.cells-for-.net/smart-markers.html

    Amjad Sahi
    Support Developer,
    Aspose Sialkot Team
    Contact Us
     
View as RSS news feed in XML