Applying styles to smartmarker?


#1

I am using smartmarker way to populate a list and its associated foot notes;
e.g.
Sample lista
Sample listb 1
Sample listc
Sample listd 2

footnotes:
1 Sample footnotes for Sample listb
2 Sample footnotes for Sample listd

I want to appy superscript style to the numbers that indicate footnotes (anchors), how can I achieve so?


#2

Hi,

Thanks for considering Aspose.

If you are using Aspose.Cells for .Net, you may use IsSuperscript property of Font Class to make the data of a cell superscript e.g., cell.Style.Font.IsSuperscript = true;

Regards

Amjad Sahi

Aspose Nanjing Team


#3

Hi,

You are right, if I have reference to the particular cell, I could set the style.

But, that doesn't answer my question or may be I haven't got it right?
For SmartMarker's, I have a couple of variables declared as e.g.
&=SampleList
&=SampleListFootnotes

and then I attach some data source with these variables, e.g.
Designer.SetDataSource("SampleList",SampleListView)
Designer.SetDataSource("SampleListFootnotes",SampleListFootnotesView)

The datasource contain the footnote anchors (text), and they get bound to the template variables at run time, right? Do I have the flexibility to manipulate the text as it gets bound to the cells? Do I have events like for example, the Repeater server control (onItemBound??)


#4

Hi,

Thanks for considering Aspose.

Do I have events like for example, the Repeater server control (onItemBound??)

Aspose.Cells don't support events.

Do I have the flexibility to manipulate the text as it gets bound to the cells?

Yes you can manipulate text in the cells when the cells are filled with data from the data source.

Here is a sample coding example which manipulate the text in A4 cell. It actually make "1" as superscript text retaining the existing data in the cell. The template file smarker has a few markers like "&=Customers.CustomerID" etc.

OleDbConnection con = new OleDbConnection("provider=microsoft.jet.oledb.4.0;data source=d:\\Northwind.mdb");

con.Open();

OleDbCommand cmd = new OleDbCommand("Select * from customers",con);

OleDbDataAdapter da = new OleDbDataAdapter();

da.SelectCommand = cmd;

DataSet ds = new DataSet();

da.Fill(ds,"Customers");

WorkbookDesigner wd = new WorkbookDesigner();

wd.Open("d:\\smarker.xls");

wd.SetDataSource(ds.Tables["Customers"]);

wd.Process(false);

Cell cell = wd.Workbook.Worksheets[0].Cells["A4"];

string txt = Convert.ToString(cell.Value);

int len = txt.Length;

txt = txt + "1";

cell.PutValue(txt);

cell.Characters(len,1).Font.IsSuperscript = true;

wd.Save("d:\\smarker1.xls");

These days, we are in the process of enhancing Smart Markers

Regards

Amjad Sahi

Aspose Nanjing Team


#5

Could you please post a sample file with smart markers and a sample file with your expected output file? Then we can understand your need more clearly. Thank you.