createOfficeViewerUrl static method

String createOfficeViewerUrl(
  1. String fileUrl
)

Creates a URL for viewing an office file using the Microsoft Office web viewer.

The generated URL can be used to view Office documents (Word, Excel, PowerPoint) in a web browser without requiring the user to have Office installed.

Parameters:

  • fileUrl: The URL of the office file to view

Returns a formatted URL that can be opened in a web browser to view the document.

Implementation

static String createOfficeViewerUrl(String fileUrl) {
  return "https://view.officeapps.live.com/op/view.aspx?src=${Uri.encodeComponent(fileUrl)}";
}