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 8549361
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T13:41:57+00:00 2026-06-11T13:41:57+00:00

I’ve had EPPlus (Office Open XML) working on a Azure Web Role for some

  • 0

I’ve had EPPlus (Office Open XML) working on a Azure Web Role for some time now, but I’ve been experimenting with Azure Web Sites lately and there I’m getting a very weird error;

[DivideByZeroException: Attempted to divide by zero.]
   System.Decimal.FCallDivide(Decimal& d1, Decimal& d2) +0
   OfficeOpenXml.Drawing.ExcelDrawing.SetPixelWidth(Int32 pixels, Single dpi) +465
   Compliance.Net.CommonCode.PivotGenerator.GeneratePivotTable(ExcelWorksheet dataWorksheet, ExcelWorksheet pivotWorksheet, Int32 endRow)

I am getting this on the same data and code as is running on Azure Web Role.

Edit:
The offending lines look like this:

 var chart = pivotWorksheet.Drawings.AddChart("PivotChart", eChartType.ColumnClustered, pivotTable);
 chart.SetPosition(endRow + 2, 20, 1, 10);
 chart.SetSize(600, 400);

Please note that I have made sure that ‘endRow’ is > 1.

Any ideas?

  • 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-06-11T13:41:58+00:00Added an answer on June 11, 2026 at 1:41 pm

    Having had the same issue myself I’ve pulled the EPPlus source and done some sleuthing.

    The issue is in ExcelWorkbook.cs line 283 which calls

    System.Windows.Forms.TextRenderer.MeasureText(string,Font).Width

    which appears to return Zero in an Azure website.

    I’ve just added a line

    if (_standardFontWidth == 0) _standardFontWidth = 7;

    (7 was the value I was getting locally so it will do as my default – your mileage may vary) meaning I ended up with

        public decimal MaxFontWidth 
        {
            get
            {
                if (_standardFontWidth == decimal.MinValue)
                {
                    var font = Styles.Fonts[0];
                    System.Drawing.Font f = new System.Drawing.Font(font.Name, font.Size);
                    _standardFontWidth=(decimal)(System.Windows.Forms.TextRenderer.MeasureText("00", f).Width - System.Windows.Forms.TextRenderer.MeasureText("0", f).Width);
                }
                if (_standardFontWidth == 0) _standardFontWidth = 7;
                return _standardFontWidth;
            }
        }
    

    Of course this means building EPPlus from source, and you may have a different value for 7, but its a useful workaround for me!

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

Sidebar

Related Questions

I have a jquery bug and I've been looking for hours now, I can't
Seemingly simple, but I cannot find anything relevant on the web. What is the
I'm working with an upstream system that sometimes sends me text destined for HTML/XML
link Im having trouble converting the html entites into html characters, (&# 8217;) i
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
For some reason, after submitting a string like this Jack’s Spindle from a text
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
this is what i have right now Drawing an RSS feed into the php,

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.