导出的Excel链接未重定向 [英] Exported Excel Link doesn't redirected

查看:122
本文介绍了导出的Excel链接未重定向的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我的问题是导出的excel链接没有重定向。实际上我有一个数据网格维护一些值,我有导出到Excel的选项。我可以将网格值导出为ex​​cel。但导出后,每当我点击特定的ID时,它应该重定向到网站。这是我导出到excel的代码,任何人都可以帮我指导excel内容。



Hi Everyone,

In my problem is the exported excel link doesn't redirected. Actually i have a datagrid which maintain some values and i have the export to excel option. I can export the grid value to excel. But after exporting, whenever i click the particular id it should redirect to website. This is my code to export to excel , can anyone help me to direct the excel content.

void ExportToExcel(GridGroupingControl grid)
       {


           try
           {
               GroupingGridExcelConverter.GroupingGridExcelConverterControl converter = new GroupingGridExcelConverter.GroupingGridExcelConverterControl();
               SaveFileDialog saveFileDialog = new SaveFileDialog();
               saveFileDialog.Filter = "Files(*.xls)|*.xls";
               saveFileDialog.DefaultExt = ".xls";
               saveFileDialog.FileName = "Forum List";
               if (saveFileDialog.ShowDialog() == DialogResult.OK)
               {

                   this.Cursor = Cursors.AppStarting;
                   converter.QueryImportExportCellInfo += new GridExcelConverter.GridImportExportCellInfoEventHandler(converter_QueryImportExportCellInfo);
                   converter.GroupingGridToExcel(grid, saveFileDialog.FileName, GridExcelConverter.ConverterOptions.Default);
                   this.Cursor = Cursors.Default;
                   System.Windows.Forms.DialogResult dialogResult = MessageBox.Show("Report saved as " + saveFileDialog.FileName + ". Do you want to open it now?", "Confirmation", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
                   if (dialogResult.ToString().ToLower().Equals("yes"))
                   {
                       System.Diagnostics.Process.Start(saveFileDialog.FileName);
                   }
               }
           }
           catch (Exception exc)
           {
               this.Cursor = Cursors.Default;
               MessageBox.Show("Please close the Excel file opened with the same name and try again!", "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
               _error.LogMessageToFile("Error occured in Forum Viewer-ExportToExcel() due to " + exc.StackTrace);
           }





先谢谢。

Arunkumar M



Thanks in Advance.
Arunkumar M

推荐答案

首先,我假设你的意思是excel没有打开一个网站,因为重定向是一个浏览器,或者更确切地说,一个http响应相关的东西,并且与你的网格或excel无关。

我的第二个猜测是,你试图附加一个id的链接(也许是列号!?)。所以可能有3个陷阱:

1)我弄错了,有一个网址解决问题,如真正的重定向问题,或破坏的相对链接等。

2)您在研磨中选择了错误的列类型,并且链接未按原样导出,例如只导出id。在这种情况下,你的Syncfusion组件的导出被破坏(因为你)或不支持(因为他们懒惰的骨头)

3)列IS或HAS的转换由你自己编码。在第一种情况下,您组装了一个无效的链接,或者第二种情况,您没有为该列指定转换,因此Syncfusion组件进行猜测或采用默认(显然是错误的)转换方法,如object {id:integer ,link:string}得到输出为object.id(默认选择第一个属性或主键)。



希望这会有所帮助。
first of all, I assume that you mean excel does not "open a website", for "redirection" is a browser, or more precise, a http response related thing and has nothing to do with your grid or excel.
my second guess is, that you are trying to attach a link to an id (maybe the column number!?). so there maybe 3 pitfalls:
1) I got you wrong and there is a url resolution issue like a real redirect issue, or broken relative links, etc.
2) you choose the wrong column type in you grind and the link is not exported as such, e.g. only the id gets exported. in this case the export of your Syncfusion component is broken (because of you) or not supported (because of them lazy bones)
3) the conversion of the column IS or HAS to be coded by your self. in the fist case, you assembled an invalid link or, second case, you did not specify the transformation for that column, so the Syncfusion component makes a guess or takes a default (obviously the wrong one) transformation method like object{id: integer, link: string} get output as object.id (by default first property or primary key is chosen).

hope this helps.


这篇关于导出的Excel链接未重定向的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆