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

Free Support Forum - aspose.com

Aspose Cells version 8.6 Include a new font

I’m trying to load a font (attached .ttf file) that a WorkBook uses. I’ve got it installed on my machine and it’s working fine if I try to open the attached xlsx file on excel, but it seems that Aspose is not able to find it. We’re using Aspose.Cells version 8.6, and it doesn’t seem to include the FontConfigs API.

How can I get the font to load in Aspose.Cells v8.6?
test file and barcode font.zip (18.9 KB)

OS: Windows 10

Thank you for your query.

You are right that FontConfigs was not available in v8.6 and it was introduced in v 8.9.1. You may please upgrade your version to the latest version for using this feature. Please note that we provide support for the latest version here at Aspose.

Thank you for your response.

I did the update to the latest version of Aspose.Cells and had to change a few namespace references., and my solution builds fine. Are there any breaking changes to consider while doing the upgrade?

Also I was able to load the font file through the FontConfigs class and it works properly now.

I have another query regarding Aspose.Cells.WorkBook.Replace(). I am trying to replace cells whose content starts and ends with an ‘’ to remove the surrounding '’.

            Dim wb As New Aspose.Cells.Workbook(ms)
            Dim replaceOptions As Aspose.Cells.ReplaceOptions = New Aspose.Cells.ReplaceOptions()
            replaceOptions.RegexKey = True

            wb.Replace("(\*)(.+)(\*)", "$2", replaceOptions)

I’m trying to use a regex here and expect it to work as in Regex.Replace
But it doesn’t replace any of the cells on the WorkBook.

Thank you for the feedback.

Good to know that your solution is compiled. Regarding the breaking changes, since you were using quite an older version and lot of changes and upgradations are done since then. It is quite difficult to provide the exact difference between your previous version and current version. However, you may check your solution for any deprecated calls and replace them with the alternate calls (if any). Once there is no deprecated call and your solution is compiling, you are good to go. If you feel any problem with the new version, please share the detailed description, runnable sample code, program output and expected output for our analysis. Same is the requirement for your current replace issue. Please share your template file and expected output file created by MS Excel file for our reference. We will test the scenario and provide assistance accordingly.

Just for your consumption, sample code is given here which uses regex for finding text in a sample Excel file. Please refer to it for the usage of regex.

//string testStr = "[hello], [list3], [another_example]. However";

//string regEx = "\\[[a-zA-Z0-9_]+]";

string testStr = @"[hello], [list3
], [another_example]. 

string regEx = "[\r\n]+";

Regex reg = new Regex(regEx);
MatchCollection v = reg.Matches(testStr);

//regEx works fine and finds 3 matches
foreach (Match m in v)

Workbook workbook = new Workbook(filePath + "sample.xlsx");

Worksheet worksheet = workbook.Worksheets[0];

FindOptions options = new FindOptions();
options.RegexKey = true;
options.LookInType = LookInType.Values;
options.LookAtType = LookAtType.Contains;
options.SetRange(new CellArea() { StartColumn = 0, EndColumn = 0, StartRow = 0, EndRow = 20 });
//options.IsRangeSet = true;

//Cells.Find method does not find any cell with regEx
Aspose.Cells.Cell found = null;

    found = worksheet.Cells.Find(regEx, found, options);
    if (found == null)
    Console.WriteLine($"Name = {found.Name}, {found.Value}");

} while (found != null);

workbook.Save(filePath + "output.xlsx");