我们使用PowerBI将PowerBI报告集成到web应用程序中,并使用ReactJS库嵌入该报告。
我们有一个新的要求导出报告PDF和PPTX。
场景1:如果用户选择页面中的某个区域,并且在下载的报告中,它应该只突出显示PDF/PPTX中的数据。
当我从app.powerbi.com门户下载它时,这是可行的,但是我们如何以编程方式实现呢?
问题:如何使用C# Power从页面中获取当前区域的选择?
场景2:如果报表有多个页面,并且用户只想下载一个特定的页面,并使用当前的选择/默认值
问题:如何使用 Power获取和传递当前页/所有当前选择/默认值
发布于 2021-06-13 22:57:31
使用REST将Power报告导出到PDF、PPTX或PNG文件现在正在预览中
请注意,您要导出的报表和数据集都必须驻留在高级容量或嵌入式容量上。其他预览局限性将在出口报告归档中详细介绍。
请注意,作为所有新的Power,导出到文件API只包含在.NET SDK v3中。
您可以在官方文档中找到使用Power BI REST API导出文件所需的所有信息
ExportReportPage场景2:使用参数
场景1:使用在PowerBIReportExportConfiguration中使用reportLevelFilters,可以在筛选的条件下导出报表。若要导出筛选后的报表,请将要用作筛选器的URL查询字符串参数插入到ExportFilter。输入字符串时,必须删除URL查询参数的?filter=部分。
下面是导出请求的代码示例:端到端示例
https://learn.microsoft.com/en-us/power-bi/developer/embedded/export-to#limitations
请参阅嵌入链接。
例如,对特定页面发送导出请求。
private async Task<string> PostExportRequest(
Guid reportId,
Guid groupId,
FileFormat format,
IList<string> pageNames = null, /* Get the page names from the GetPages REST API */
string urlFilter = null)
{
var powerBIReportExportConfiguration = new PowerBIReportExportConfiguration
{
Settings = new ExportReportSettings
{
Locale = "en-us",
},
// Note that page names differ from the page display names
// To get the page names use the GetPages REST API
Pages = pageNames?.Select(pn => new ExportReportPage(Name = pn)).ToList(),
// ReportLevelFilters collection needs to be instantiated explicitly
ReportLevelFilters = !string.IsNullOrEmpty(urlFilter) ? new List<ExportFilter>() { new ExportFilter(urlFilter) } : null,
};
var exportRequest = new ExportReportRequest
{
Format = format,
PowerBIReportConfiguration = powerBIReportExportConfiguration,
};
// The 'Client' object is an instance of the Power BI .NET SDK
var export = await Client.Reports.ExportToFileInGroupAsync(groupId, reportId, exportRequest);
// Save the export ID, you'll need it for polling and getting the exported file
return export.Id;
}
https://stackoverflow.com/questions/67938785
复制相似问题