Background of cell is being removed when changing the background color of Text Fragment

In the process of generating PDF from excel, I’m identifying all text fragments with in [] (i.e.m square brackets) and applying background color to highlight those occurances.
In this scenario, if the excel cell has background color, it is being removed after applying the text fragment color.
Attaching the excel and generated PDF for your reference
image.png (1.6 KB)
image.png (69.3 KB)
PdfTest.7z (784.1 KB)
Can you please help us on how to retain the background color.

@susmithaputhana,

Thanks for the Excel file, PDF file and screenshots.

It looks like you are using both Aspose.Cells and Aspose.PDF APIs. It seems the issue is related to Aspose.PDF. Anyways, could you please also share your code snippet that you are using to identify all text fragments with in [] (i.e., m square brackets) and applying background color to highlight those occurrences. We will check your issue soon.

var doc = new Aspose.Pdf.Document(excelFullPath);

var searchTerm = “\[(.*?)\]”;
TextFragmentAbsorber textFragmentAbsorber = new TextFragmentAbsorber(searchTerm);
TextSearchOptions textSearchOptions = new TextSearchOptions(true);
textFragmentAbsorber.TextSearchOptions = textSearchOptions;

doc.Pages.Accept(textFragmentAbsorber);
TextFragmentCollection textFragmentCollection = textFragmentAbsorber.TextFragments;
foreach (var textFragment in textFragmentCollection)
{

textFragment.TextState.ForegroundColor = Color.White;
textFragment.TextState.BackgroundColor =Color.Black;
textFragment.Text = textFragment.Text.Replace("[", "").Replace("]", "");

}

@susmithaputhana,

Thanks for the code segment.

I am moving your thread to respective forum where one of our fellow colleagues from Aspose.PDF team will evaluate your issue and assist you accordingly.

Can anyone please provide an update on this issue. It is a blocker for us

@susmithaputhana

We are checking it and will get back to you shortly.

@susmithaputhana

Can you please share the generated PDF at your end that you are obtaining from Excel file? We will use your code snippet on that PDF and see how API is generating the output in our environment.

I have already shared in the zip file. Sharing again for your reference
redactedOutput.pdf (490.3 KB)

@susmithaputhana

That PDF is produced by Aspose.PDF after performing modifications. We requested for the PDF that you generated from Excel using Aspose.Cells. Nevertheless, we will try to generate it at our end. Can you please share which code snippet you used for Aspose.Cells.

var excelFullPath = Path.GetTempPath() + “test.pdf”;
var saveOptions = new Aspose.Cells.PdfSaveOptions
{
GridlineType = GridlineType.Hair,
OutputBlankPageWhenNothingToPrint = true,
};

foreach (var worksheet in workbook.Worksheets)
{
worksheet.AutoFitColumns();
worksheet.AutoFitRows();
}
workbook.Save(excelFullPath, saveOptions);

@susmithaputhana

We are checking it and will get back to you shortly.

Can you please provide an update on this issue

@susmithaputhana

We apologize for the delay. We will be performing initial investigation soon and will share our finding with you.

Any update on this issue ?

@susmithaputhana

We tested the scenario and performed initial investigation using 23.10 version of both Aspose.PDF and Aspose.Cells APIs. We were able to notice the issue in our environment.

Therefore, we have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-55753

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

Any update on this issue ?

@susmithaputhana

We regret to inform you that the previously logged ticket remains unresolved at present, primarily due to higher-priority issues that were reported earlier. Rest assured, we will prioritize the resolution of your ticket on a first-come, first-serve basis. As progress is made towards its resolution, we will provide updates in this forum thread. We appreciate your patience and apologize for any inconvenience this may have caused.