Hi,<br><br>ScPrintFunc is the correct place but not nPageNo. So <a href="http://opengrok.libreoffice.org/xref/core/sc/source/ui/view/printfun.cxx#2670" target="_blank">http://opengrok.libreoffice.org/xref/core/sc/source/ui/view/printfun.cxx#2670</a> is responsible for printing and you should have a closer look at it. I think that with the context of lines 2719 to 2778 the main idea should be clear:<br>
-Get the range we need to print to one page<br>-call ScPrintFunc::Print with this range<br><br>Maybe the best idea is to set a breakpoint in ScPrintFunc::Print and look where it is called and what are the parameters.<br><br>
I&#39;ll translate the german comments in this section for you. If you still have any questions feel free to write a mail or ask on #libreoffice-dev.<br><br>Regards,<br>Markus<br><br><div class="gmail_quote">2011/8/26 Ta Duc Tung <span dir="ltr">&lt;<a href="mailto:tatung2112@gmail.com" target="_blank">tatung2112@gmail.com</a>&gt;</span><br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000"><div>
    On 08/18/2011 01:19 AM, Markus Mohrhard wrote:
    </div><div><div></div><div><blockquote type="cite">Hello,<br>
      <br>
      <div class="gmail_quote">2011/8/17 Ta Duc Tung <span dir="ltr">&lt;<a href="mailto:tatung2112@gmail.com" target="_blank">tatung2112@gmail.com</a>&gt;</span><br>
        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
          Hi,<br>
          <br>
          I&#39;m trying to fix the bug number #34697 in<br>
          <a href="https://bugs.freedesktop.org/show_bug.cgi?id=34697" target="_blank">https://bugs.freedesktop.org/show_bug.cgi?id=34697</a><br>
          (No option for printing current page).<br>
          <br>
          The bug was fixed in Writer. Now I&#39;m trying to make it in
          Calc. The problem is that I don&#39;t know how to get the current
          page number. If in Writer, I can get the current cursor then
          get the page number from that cursor, but in Calc, where
          should I start?<br>
        </blockquote>
        <div><br>
          I think we have someting in this direction already in calc.
          You should have a closer look at ScPrintFunc, especially at
          ScPrintfunc::PrintPage.<br>
        </div>
        <br>
      </div>
      Regards,<br>
      Markus<br>
    </blockquote></div></div>
    Hi, <br>
    <br>
    I&#39;ve tried to look into ScPrintFunc. In PrintPage, I see a param
    named nPageNo but when I print it out, the value is always 0. This 
    is probably not the current page :D. But I cannot find any other
    hint closed to finding current page rather than the nPageNo one :|.<br>
    <br>
    I think I can somehow get it from ScDocShell or ScDocument but still
    no hope. I&#39;m still losing my way here. Anyone please help!<br>
    <br>
    Thank and Best Regards,<br><font color="#888888">
    Ta Tung<br>
  </font></div>

</blockquote></div><br>