Unable to set HtmlLinkTargetType to self or parent

I am trying to implement an excel document to html iframe and I’m having an issue when trying to navigate the rendered iframe. When I click buttons for the sheets available within the excel file, a new tab is opened every time. I have tried to modify the link_target_type attribute to HtmlLinkTargetType.SELF and PARENT, but this seems to do nothing. When I dig through the html code rendered for the browser, I see that the iframe targets for the file produced are “self”. I think it needs to be “_self” in order to work properly. Is there any way a pull request can be created to update this for the aspose.cells software package?

@teddyshen

It seems you are experiencing issues with setting the HtmlLinkTargetType to SELF or PARENT when saving an Excel document as HTML, which results in new tabs opening instead of navigating within the same iframe.

To address this, you can use the HtmlSaveOptions class to specify the link target type. Here’s a code example in Java that demonstrates how to set the link target type to SELF:

import com.aspose.cells.HtmlLinkTargetType;
import com.aspose.cells.HtmlSaveOptions;
import com.aspose.cells.Workbook;
import AsposeCellsExamples.Utils;

public class ChangeHtmlLinkTarget {
    public static void main(String[] args) throws Exception {
        String dataDir = Utils.getSharedDataDir(ChangeHtmlLinkTarget.class) + "TechnicalArticles/";
        String inputPath = dataDir + "Sample1.xlsx";
        String outputPath = dataDir + "CHLinkTarget.html";

        Workbook workbook = new Workbook(inputPath);
        HtmlSaveOptions opts = new HtmlSaveOptions();
        opts.setLinkTargetType(HtmlLinkTargetType.SELF); // Set link target type to SELF

        workbook.save(outputPath, opts);
        System.out.println("File saved " + outputPath);
    }
}

In this example, the HtmlLinkTargetType.SELF is set, which should ideally prevent new tabs from opening when navigating through the links in the generated HTML. If you are still facing issues, it might be worth checking the generated HTML to ensure that the target attributes are being set correctly.

If you believe that the current implementation does not support your needs, you might consider submitting a pull request to the Aspose.Cells repository to enhance this functionality.

For further reference, you can check the following examples that demonstrate changing the HTML link target type:

If you continue to have issues, please provide more details about the specific behavior you are observing, and I would be happy to assist further.