J
Jeff Donkersgoed
I've got a c# program that's used to dynamically create spreadsheets. At the
end, I save the workbook both as an .xlsx file as well as a .xls file. My
problem is that the charts in the .xls file, although the box remains the
same size, the contents (bars, height of the vertical axis) get
"squished"--that is, there is more space in the bottom half then there should
be causing the rest to resize to fit (happens most noticably vertically, but
also slightly horizontally). I've narrowed it down to finding out that the
presence of textboxes in the chart "causes" it to squish. If I don't have
the textboxes, the chart appears normal. Can anyone think of something that
may cause this? I'm opening both files in Excel 2007.
Here is the code relating to text box creation I'm using:
Excel.Shape label =
chartobj.Chart.Shapes.AddLabel(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationHorizontal, 75, 15, 140, 140);
label.Select(Type.Missing);
label.TextFrame.Characters(Missing.Value, Missing.Value).Text = "Very High
Risk";
label.TextFrame.AutoSize = true;
label.ControlFormat.PrintObject = true;
chartobj.Chart.ChartArea.AutoScaleFont = false;
Excel.TextBoxes textBoxes =
(Excel.TextBoxes)chartobj.Chart.TextBoxes(Type.Missing);
textBoxes.Font.Name = "Arial";
textBoxes.Font.Size = 16;
textBoxes.AutoScaleFont = false;
textBoxes.PrintObject = true;
end, I save the workbook both as an .xlsx file as well as a .xls file. My
problem is that the charts in the .xls file, although the box remains the
same size, the contents (bars, height of the vertical axis) get
"squished"--that is, there is more space in the bottom half then there should
be causing the rest to resize to fit (happens most noticably vertically, but
also slightly horizontally). I've narrowed it down to finding out that the
presence of textboxes in the chart "causes" it to squish. If I don't have
the textboxes, the chart appears normal. Can anyone think of something that
may cause this? I'm opening both files in Excel 2007.
Here is the code relating to text box creation I'm using:
Excel.Shape label =
chartobj.Chart.Shapes.AddLabel(Microsoft.Office.Core.MsoTextOrientation.msoTextOrientationHorizontal, 75, 15, 140, 140);
label.Select(Type.Missing);
label.TextFrame.Characters(Missing.Value, Missing.Value).Text = "Very High
Risk";
label.TextFrame.AutoSize = true;
label.ControlFormat.PrintObject = true;
chartobj.Chart.ChartArea.AutoScaleFont = false;
Excel.TextBoxes textBoxes =
(Excel.TextBoxes)chartobj.Chart.TextBoxes(Type.Missing);
textBoxes.Font.Name = "Arial";
textBoxes.Font.Size = 16;
textBoxes.AutoScaleFont = false;
textBoxes.PrintObject = true;