Interface IFilePathProvider

IFilePathProvider interface

Represents the exported file path provider.

public interface IFilePathProvider

Methods

NameDescription
GetFullName(string)Gets the full path of the file by Worksheet name when exporting Worksheet to html separately. So the references among the Worksheets can be exported correctly.

Examples

[C#]

namespace Demos
{
    using Aspose.Cells;
    using System;

    public class IFilePathProviderDemo : IFilePathProvider
    {
        // Implementing the GetFullName method from the IFilePathProvider interface
        public string GetFullName(string sheetName)
        {
            // For demonstration, return a simple file path based on the sheet name
            return $"{sheetName}.html";
        }

        public static void IFilePathProviderExample()
        {
            // Create a new workbook and add some data
            Workbook workbook = new Workbook();
            Worksheet worksheet = workbook.Worksheets[0];
            worksheet.Cells["A1"].PutValue("Hello");
            worksheet.Cells["A2"].PutValue("World");

            // Create HtmlSaveOptions and set the FilePathProvider
            HtmlSaveOptions saveOptions = new HtmlSaveOptions();
            saveOptions.FilePathProvider = new IFilePathProviderDemo();

            // Save the workbook to HTML format
            workbook.Save("IFilePathProviderExample.html", saveOptions);

            Console.WriteLine("Workbook saved to HTML with custom file paths.");
        }
    }


}

See Also