User (Legacy) Posted November 13, 2003 Report Share Posted November 13, 2003 Greetings, I designed a function that export all chart and tables in my application to an Excel file. I use the Export with metafile parameter to do so. However, the series legend box appears sporadically. I tried to standardize all my chartfx control to isolate the problem, no success. I use a function to which I pass the chart control. In that function I call the export method. How can I assure that the legend box gets exported? The chart are not necessarily displayed when the export command is called. I tried to export to a bitmap, same results. Here's the function: Public Function XLPasteChart(ByRef oExcel As Object, ByRef oxlsSheet As Object, ByVal rowno As Integer, ByRef cfx As SoftwareFX.ChartFX.Chart) Dim OSHAPE As Object Static idxFile As Integer Dim x As Integer Dim y As Integer Dim filename As String = KeopsDSS.Common.SharedProperties.SessionDirectory.FullName & "\chart" & idxFile & ".BMP" idxFile += 1 cfx.Export(FileFormat.Metafile, filename) 'Paste the File to excel oxlsSheet.SELECT() x = oxlsSheet.cells(rowno, 1).left y = oxlsSheet.cells(rowno, 1).top OSHAPE = oxlsSheet.Shapes.AddPicture(filename, False, True, x, y, cfx.Width, cfx.Height) System.Windows.Forms.Application.DoEvents() Return OSHAPE.bottomrightcell.row + 1 End Function Link to comment Share on other sites More sharing options...
Software FX Posted November 13, 2003 Report Share Posted November 13, 2003 I tried the following very simple Windows Form app: Chart chart = new Chart(); chart.Width = 500; chart.Height = 400; chart.SerLeg[0] = "Series 1"; chart.SerLeg[1] = "Series 2"; chart.SerLegBox = true; chart.Export(FileFormat.Metafile,@"d:\\temp\\cfx.emf"); As you can see the chart is created but never displayed yet I get the appropriate information in the legend box. I tested this in both Chart FX for .NET 6.0 and 6.2 (Windows Forms). Please try this code and let me know what you get. Then, tell us what you are doing different and, if possible, send us the modified code that reproduces the problem. What version -- FP Software FX, Inc. Link to comment Share on other sites More sharing options...
User (Legacy) Posted November 13, 2003 Author Report Share Posted November 13, 2003 Your sample code did work. I'm using VB.NET and the ChartFX control version 6.0.839.0 What I'm doing differently is that I'm not explicitly adding series description to the Serleg object. It's done by using the Series(0).Legend = "Legend Text". I tried to reset the Legend by clearing the Serleg collection and adding the Legend Text. No success. When I display the serleg.count property before I export it's set to the right number of series. When I display the chart on screen and export it with the toolbar menu, i get the series legend. When I'm using the export function, it doesn't work. I moved the function block where I export in the user control and it still doesn't work. I added the following lines to my Export function and still doesn't work cfx.SerLegBoxObj.Visible = True cfx.SerLegBoxObj.Alignment = ToolAlignment.Near cfx.SerLegBoxObj.Docked = Docked.Bottom cfx.Refresh() cfx.Update() Thanks for your help! Link to comment Share on other sites More sharing options...
User (Legacy) Posted November 13, 2003 Author Report Share Posted November 13, 2003 As strange as it may seems, I call the show method before the export and the chart gets exported correctly (as it appears on screen)... My problem is now solved Thanks "Beno Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.