How to format Smart Markers

hi can you tell how to format excel directly using smart markers, that is i have template and in that template i have made format to each cell,according to that format my data should display like percentage,numeric and i don’t want to do any coding.Everything i need to do in template thats is all formatting in exce should reflect in output

Hi,


Well, you may try to format the cell(s) which contains Smart Marker(s) in the template file accordingly. E.g you have a smart marker in a cell i.e. &=DataSource.FieldName Now right click on the cell in MS Excel and click “Format Cells…”, now you can format the cell accordingly.

Thank you.

Hi,

Thanks for your posting.

Please download and use the latest version:
Aspose.Cells
for .NET v7.1.2.4


We have recently added copystyle smartmarker property in our newer versions. This property enables you to copy base cell’s style to each cell. Please see if it fits your needs.

Please see the following demo how to make use of this property.

Please see the source xlsx file used in this code and the output xlsx file generated by it. I have also attached the screenshot for your reference.

C#


string filePath = @“D:\source.xlsx”;


Workbook wb = new Workbook(filePath);

WorkbookDesigner d = new WorkbookDesigner();

d.Workbook = wb;

DataTable dt = new DataTable(“MyDataSource”);

dt.Columns.Add(“ProjectID”);

dt.Columns.Add(“ProjectName”);

dt.Columns.Add(“ProjectStatus”);

dt.Rows.Add(new object[] { “1”, “2”, “3” });

dt.Rows.Add(new object[] { “1”, “2”, “3” });

dt.Rows.Add(new object[] { “1”, “2”, “3” });

d.SetDataSource(dt);

d.Process();

wb.Save(filePath + “.out.xlsx”);


Screenshot

hi can we use &=DataSource.FieldName like &=DataSource.FieldName * 100 or &=DataSource.FieldName / 100

Hi,


You have to use dynamic formula feature of Smart Markers accordingly for your needs, see an example below, you need to set your markers in the following way.

Excel Template:
e.g
A B

&=DataSource.FieldName &=&=(A{r}*100)


See the document for your reference:
http://docs.aspose.com/display/cellsnet/Smart+Markers