
.. include:: ../substitutions

.. oe:namespace:: OEDepict

.. meta::
   :keywords: OEWriteReportToString

.. _OEDepict_OEWriteReportToString:


.. oe:function:: OEWriteReportToString


   .. oe:language:: c++ java csharp

      .. oe:api::

         std::string OEWriteReportToString(const std::string& ext,
                                           const OEReport& report,
                                           unsigned int page = 0u)

   .. oe:language:: python

      .. oe:api:: python

         OEWriteReportToString(extension: str, report: OEReport, page: int = 0) -> bytes

   Writes the report into a string.

   *ext*
      The extension which determine the type of the image.

   *report*
      The :ref:`OEReport <OEDepict_OEReport>` object of which page(s) is/are
      being written into the string.

   *pageidx*
      This value has to be in the range from `0` to
      :oe:meth:`OEDepict::OEReport::NumPages()<OEDepict::OEReport::NumPages>`.

   .. note::

      If :math:`pageidx` is a valid page number *i.e* in the range from `1` to
      :oe:meth:`OEDepict::OEReport::NumPages()<OEDepict::OEReport::NumPages>`,
      then only the :math:`pageidx^{th}` page of the report is written into the
      string.
      If :math:`pageidx` is zero and the file extension is recognized as a multi-page
      format, than all pages of the report are written into the string.

   **Example:**

   .. oe:source:: WriteReportToString.py
      :language: python
      :noindent:
      :frag:     SNIPPET-WRITE-REPORT-TO-STRING

   .. oe:source:: WriteReportToString.cpp
      :language: c++
      :noindent:
      :frag:     SNIPPET-WRITE-REPORT-TO-STRING

   .. oe:source:: WriteReportToString.java
      :language: java
      :noindent:
      :frag:     SNIPPET-WRITE-REPORT-TO-STRING

   .. oe:source:: WriteReportToString.cs
      :language: csharp
      :noindent:
      :frag:     SNIPPET-WRITE-REPORT-TO-STRING

   .. oe:language:: python

      .. note::

         In **Python 3** the :oe:func:`OEDepict::OEWriteReportToString`
         function returns ``bytes``.

   .. seealso::

      * :oe:func:`OEDepict::OEIsRegisteredMultiPageImageFile` function

      .. oe:language:: python

         * :oe:func:`OEDepict::OEWriteReportToBytes` function
