Free Support Forum - aspose.com

Removing hyperlinks causes cell formatting issues

Hello,


Removing hyperlinks using the code below causes formatting issues in the converted PDF file. Attached are the original XLS file and converted PDF. Please advise.

[TestMethod]
public void TestProcessTaskRequestExcelHyperlinks02()
{
var method = MethodInfo.GetCurrentMethod().Name;
var docFile = @“testfiles\DrawingLog2.xls”;
var pdfFile = docFile + “.” + method + “.pdf”;

var docInfo = new FileInfo( docFile );
Assert.IsTrue( (docInfo.Exists) && (docFile.Length > 0), “Invalid INPUT File” );

var pdfInfo = new FileInfo( pdfFile );
var licFile = new Aspose.Cells.License();
licFile.SetLicense( “Aspose.Total.lic” );
var doc = new Aspose.Cells.Workbook( docFile );
var options = new Aspose.Cells.PdfSaveOptions();
foreach( Aspose.Cells.Worksheet ws in doc.Worksheets )
{
ws.Hyperlinks.Clear();
foreach( Aspose.Cells.Drawing.OleObject obj in ws.OleObjects )
obj.RemoveHyperlink();
foreach( Aspose.Cells.Drawing.Shape shape in ws.Shapes )
shape.RemoveHyperlink();
}
doc.Save( pdfFile, Aspose.Cells.SaveFormat.Pdf );
pdfInfo.Refresh();
Assert.IsTrue( (pdfInfo.Exists) && (pdfInfo.Length > 0), “Invalid OUTPUT File” );
}

Thanks.

Hi,

Thanks for your posting and using Aspose.Cells.

We were able to observe this issue by executing the following code with your source excel file using the latest version: Aspose.Cells
for .NET v8.5.0.1
. Removing the hyperlinks causes formatting issues in the output pdf.

We have logged this issue in our database for investigation. We will look into it and fix this issue. Once the issue is resolved or we have some other update for you, we will let you know asap.

This issue has been logged as

  • CELLSNET-43755 - Removing hyperlinks causes cell formatting issues

I have also attached the output pdf generated by the code for a reference.

C#

string filePath = @“F:\Shak-Data-RW\Downloads\DrawingLog2.xls”;


var doc = new Aspose.Cells.Workbook(filePath);

var options = new Aspose.Cells.PdfSaveOptions();

foreach (Aspose.Cells.Worksheet ws in doc.Worksheets)

{

ws.Hyperlinks.Clear();

foreach (Aspose.Cells.Drawing.OleObject obj in ws.OleObjects)

obj.RemoveHyperlink();

foreach (Aspose.Cells.Drawing.Shape shape in ws.Shapes)

shape.RemoveHyperlink();

}

doc.Save(filePath + “.out.pdf”, Aspose.Cells.SaveFormat.Pdf);

Hi,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v8.5.0.2 and let us know your feedback.