0

Note: I am not an app developer and if what I am about to say doesn't make sense, please guide me.

I have developed a cross-platform (Windows and Android) app using .NET MAUI Blazor. Previously, I used TableToExcel.js library to save files in a Blazor WASM app.

I am using the same code and library in my current MAUI Blazor app.

The problem is that it worked fine for the Windows app but doesn't do anything on Android.

function exportReportToExcel(id, fileName, columns = null) {
    fileName += ".xlsx";

    let table = document.getElementById(id);

    TableToExcel.convert(table, {
        name: fileName, 
        sheet: {
            name: 'Sheet 1' 
        }
    });
}

I am calling this method using JSInterop and it downloads a file in Windows but not on Android.

Confession: before trying this I have an idea that it won't work as the browser and (desktop or android) apps are completely different, but I thought to give it a try when I first tried it on the windows app and it worked so I was hoping that it might work on android as well but unfortunately.

Note: if I publish the same code as blazor WASM same code works, but not working for MAUI android app.

Zubair Khakwani
  • 328
  • 5
  • 18
  • There may be a few sources of the problem you are facing. The first may be that you don't have permissions set for writing to storage, and the second may be that you need to specify the full location for the write. The third would be that the android sandbox doesn't allow the same write mechanism and you need to pass the data as a stream through to the C# code and save that way. – MiltoxBeyond Jan 16 '23 at 07:04

0 Answers0