Free Support Forum - aspose.com

Combining static text and smart marker variables in the same cell using Aspose.Cells for .NET in C#

if cell value is: "&=$Variable" then it's being evaluated correctly

However if cell value is: "Some Text &=$Variable More Text", it is not being evaluated. Is there any way around this?

The smart markers only work on whole text in a cell so your second case cannot work.

You can try this workaround:

1. In cell A1, set “&=$Variable” and hide it.
2. In your desired cell, set formula "="Some Text &A1 & “More Text”"

Or you can try this:
1. Set “&=$Variable” at your desired cell.
2. Import the designer spreadsheet, find cells with this smart marker and collect them in a collection.
3. Process the smart markers
4. use the following code to change the cell content:
Cell.PutValue(“Some Text " + cell.StringValue + " More Text”);