Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1040505
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:13:56+00:00 2026-05-16T15:13:56+00:00

I have this piece of c# code in my Excel 2003 add-in: var leafPoint

  • 0

I have this piece of c# code in my Excel 2003 add-in:

var leafPoint = m_worksheet.Shapes.Item("aPoint").Duplicate();

leafPoint.Name = "Shape" + (m_shapesNameIndex++).ToString();
leafPoint.OnAction = m_worksheet.CodeName + ".PointClicked";
leafPoint.AlternativeText = 

string.Format("Correlation Value: {0}",     
    item.PointData.Correlation.ToString("0.0000;-0.0000"));

leafPoint.Top = item.LeftChildNode.Top + 
    ((item.RightChildNode.Top - item.LeftChildNode.Top) / 2) + 
    (leafPoint.Height / 2);

When I run it in Excel 2003, it works perfectly. However, when I run it in Excel 2007, the shape’s Top value is off… It always ends up a few pixels above the intended location!

When I looked at the logs, in Excel 2003 the shapes were consistently placed in the correct position, but in Excel 2007, when the code attempts to place the shape’s Top position, Excel 2007 seems to be overriding the value for some reason (I think).

For instance, in one case the leafPoint.Top value resolved to 206.25. In Excel 2003, that was indeed the result. However, in Excel 2007, this value ends up becoming 204.2954…

Does anyone have some insight into this issue?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:13:57+00:00Added an answer on May 16, 2026 at 3:13 pm

    I finally figured it out. Based on this link Excel 2007 Service Pack 2 – the official fix list, it mentions among the fixed bugs:

    The value of the Top property of the
    Line object is affected by Zoom level.
    This leads to incorrect placement of
    line shapes when this value is set
    programmatically to lines on a sheet
    that is zoomed to anything other than
    100%.

    I figured if the Line object was affected, possibly could there have been a problem with the Shape object as well?

    So I checked my template, and indeed, it was set to 80%. (Line objects work fine, by the way, since my Excel version has SP2 installed). As soon as I set the zoom level to 100%, the shape objects suddenly rendered to the position they were expected to.

    Another note: this problem only occurs during rendering. Once all the shapes have been drawn, I can set the zoom level to whatever I want, and the shapes position themselves properly.

    Conclusion: whenever drawing shapes in Excel, always set the zoom level to 100%. After all the drawing is done, you can set the zoom level back to the original desired zoom.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this piece of code: $(#faq).click(function () { var url = $.get(faq, {
I have this piece of code: var myObj = function () { this.complex =
Win-XP / Excel 2003 / VBA .... I have the following piece of code
I have this piece of code I've done so far: $assign = $_POST['assign']; if(!empty($name)
I have this piece of code which works in Firefox link = $('<a>link</a>'); var
I have this piece of code: <textarea id=test style=width: 400px; height: 100px></textarea> <script> var
I have this piece of code (summarized)... AnsiString working(AnsiString format,...) { va_list argptr; AnsiString
I have this piece of code #include <stdio.h> #include <stdlib.h> #include <stdint.h> #include <string.h>
I have this piece of code I'm trying to get to display but no
I have a piece of code looking like this : TAxis *axis = 0;

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.