I'm using the latest Spreadsheet Gear and C# on .NET 3.5
I'm generating a spreadsheet and adding various formatting to it. One thing I would like to do is add an image to the left header section of my spreadsheet 开发者_Go百科for printing. How do I achieve this?
I have tried:
worksheet.PageSetup.LeftHeader = Image.FromFile("file location");
but that doesn't seem to work. When I look at an example in Excel, I notice that excel sees a headed picture as "&[Picture]", but doesn't specify a file path.
Does anyone know the solution to this?
A little late, but here we go:
You we're right with the first line:
worksheet.PageSetup.LeftHeader = "Filename or URL"
but you missed the second command:
xlsheet.PageSetup.LeftHeader = "&G"
there is the usual problem with different languages. For example, if you'd prefer to use Excel in German this tag becomes ="&I" (for no obvious reason)
You can adjust your image with the usual commands.
I created a workaround: My image was essentially fancy text with lots of colors. I came up with 2 ways of embedding the text. 1- make an excel file as an embedded resource with all the header formatting you need and just open that with SSG. 2- save an excel file with all the formatting you need in the xml format and inspect it with something like notepad++ to see what excel is representing the data as. In my case, I needed a navy color and excel was calling it something like &20&K04-024text for size 20 navy text. As far as I can tell, it's not possible to put an image in the header.
精彩评论