Browse our Products

Aspose.Words for C++ 23.4 Release Notes

Major Features

There are 70 improvements and fixes in this regular monthly release. The most notable are:

  • Added an ability to set distance between table and surrounding text.
  • Provided an ability to determine whether a Run is a phonetic guide run.
  • Implemented the simple way to work with series and axes of a combo charts.
  • Provided the new public properties connected to the shape relative positioning and sizing.
  • Improved accuracy and performance of color brightness calculation for automatic text color resolution in accordance with the latest versions of MS Word.

Full list of changes

Public API and Backward Incompatible Changes

This section lists public API changes that were introduced in Aspose.Words 23.4. It includes not only new and obsoleted public methods, but also a description of any changes in the behavior behind the scenes in Aspose.Words which may affect existing code. Any behavior introduced that could be seen as regression and modifies the existing behavior is especially important and is documented here.

Added ability to set distance between table and surrounding text

Now you can set the following properties of the Table class:

    /// Gets or sets distance between table left and the surrounding text, in points.
    ///
    /// @par Examples
    ///
    /// Shows the minimum distance operations between table boundaries and text.
    /// @code
    /// auto doc = MakeObject<Document>(MyDir + u"Table wrapped by text.docx");
    ///
    /// SharedPtr<Table> table = doc->get_FirstSection()->get_Body()->get_Tables()->idx_get(0);
    ///
    /// ASPOSE_ASSERT_EQ(25.9, table->get_DistanceTop());
    /// ASPOSE_ASSERT_EQ(25.9, table->get_DistanceBottom());
    /// ASPOSE_ASSERT_EQ(17.3, table->get_DistanceLeft());
    /// ASPOSE_ASSERT_EQ(17.3, table->get_DistanceRight());
    /// @endcode
    ASPOSE_WORDS_SHARED_API double get_DistanceLeft();
    
    /// Setter for Aspose::Words::Tables::Table::get_DistanceLeft
    ASPOSE_WORDS_SHARED_API void set_DistanceLeft(double value);
    
    /// Gets or sets distance between table right and the surrounding text, in points.
    ///
    /// @par Examples
    ///
    /// Shows the minimum distance operations between table boundaries and text.
    /// @code
    /// auto doc = MakeObject<Document>(MyDir + u"Table wrapped by text.docx");
    ///
    /// SharedPtr<Table> table = doc->get_FirstSection()->get_Body()->get_Tables()->idx_get(0);
    ///
    /// ASPOSE_ASSERT_EQ(25.9, table->get_DistanceTop());
    /// ASPOSE_ASSERT_EQ(25.9, table->get_DistanceBottom());
    /// ASPOSE_ASSERT_EQ(17.3, table->get_DistanceLeft());
    /// ASPOSE_ASSERT_EQ(17.3, table->get_DistanceRight());
    /// @endcode
    ASPOSE_WORDS_SHARED_API double get_DistanceRight();
    
    /// Setter for Aspose::Words::Tables::Table::get_DistanceRight
    ASPOSE_WORDS_SHARED_API void set_DistanceRight(double value);
    
    /// Gets or sets distance between table top and the surrounding text, in points.
    ///
    /// @par Examples
    ///
    /// Shows the minimum distance operations between table boundaries and text.
    /// @code
    /// auto doc = MakeObject<Document>(MyDir + u"Table wrapped by text.docx");
    ///
    /// SharedPtr<Table> table = doc->get_FirstSection()->get_Body()->get_Tables()->idx_get(0);
    ///
    /// ASPOSE_ASSERT_EQ(25.9, table->get_DistanceTop());
    /// ASPOSE_ASSERT_EQ(25.9, table->get_DistanceBottom());
    /// ASPOSE_ASSERT_EQ(17.3, table->get_DistanceLeft());
    /// ASPOSE_ASSERT_EQ(17.3, table->get_DistanceRight());
    /// @endcode
    ASPOSE_WORDS_SHARED_API double get_DistanceTop();
    
    /// Setter for Aspose::Words::Tables::Table::get_DistanceTop
    ASPOSE_WORDS_SHARED_API void set_DistanceTop(double value);
    
    /// Gets or sets distance between table bottom and the surrounding text, in points.
    /// 
    /// @par Examples
    /// 
    /// Shows the minimum distance operations between table boundaries and text.
    /// @code
    /// auto doc = MakeObject<Document>(MyDir + u"Table wrapped by text.docx");
    /// 
    /// SharedPtr<Table> table = doc->get_FirstSection()->get_Body()->get_Tables()->idx_get(0);
    /// 
    /// ASPOSE_ASSERT_EQ(25.9, table->get_DistanceTop());
    /// ASPOSE_ASSERT_EQ(25.9, table->get_DistanceBottom());
    /// ASPOSE_ASSERT_EQ(17.3, table->get_DistanceLeft());
    /// ASPOSE_ASSERT_EQ(17.3, table->get_DistanceRight());
    /// @endcode
    ASPOSE_WORDS_SHARED_API double get_DistanceBottom();
    
    /// Setter for Aspose::Words::Tables::Table::get_DistanceBottom
    ASPOSE_WORDS_SHARED_API void set_DistanceBottom(double value);

Please note: setting these properties makes the table floating.

    auto doc = System::MakeObject<Aspose::Words::Document>(u"input.docx");
    auto table = doc->get_FirstSection()->get_Body()->get_Tables()->idx_get(0);
    
    // Set distance between table and surrounding text.
    table->set_DistanceLeft(24);
    table->set_DistanceRight(24);
    table->set_DistanceTop(3);
    table->set_DistanceBottom(3);
        
    doc->Save(u"output.docx");

Added public property GradientStop.BaseColor

The following public property was added to the Aspose.Words.Drawing.GradientStop class:

    /// Gets a value representing the color of the gradient stop without any modifiers.
    ASPOSE_WORDS_SHARED_API System::Drawing::Color get_BaseColor();
    System::SharedPtr<Aspose::Words::DocumentBuilder> builder = System::MakeObject<Aspose::Words::DocumentBuilder>();
    System::SharedPtr<Aspose::Words::Drawing::Shape> shape = builder->InsertShape(Aspose::Words::Drawing::ShapeType::Balloon, 300, 300);
    
    // Set stroke thickness to 7pt.
    shape->get_Stroke()->set_Weight(7);
        
    // Fill the stroke with one-color gradient.
    shape->get_Stroke()->get_Fill()->OneColorGradient(System::Drawing::Color::get_Red(), Aspose::Words::Drawing::GradientStyle::Horizontal, Aspose::Words::Drawing::GradientVariant::Variant1, 0.1);
        
    // In OneColorGradient the second color is set automatically by adding to the first color either tint or shade.
    // So, we can check unmodified color is actually those we set to the first color.
    System::SharedPtr<Aspose::Words::Drawing::GradientStop> gradientStop = shape->get_Stroke()->get_Fill()->get_GradientStops()->idx_get(1);
    System::Console::WriteLine(u"The color is: {0}", gradientStop->get_Color());
    System::Console::WriteLine(u"The base (unmodified) color is: {0}", gradientStop->get_BaseColor());
    
    /* This code produces the following output:
    The color is: Color [A=255, R=51, G=0, B=0]
    The base (unmodified) color is: Color [A=255, R=255, G=0, B=0]
    */

Added public property Run.IsPhoneticGuide

The following public property was added to Aspose.Words.Run class:

    /// Gets a boolean value indicating either the run is a phonetic guide.
    ASPOSE_WORDS_SHARED_API bool get_IsPhoneticGuide();    

    System::SharedPtr<Aspose::Words::DocumentBuilder> builder = System::MakeObject<Aspose::Words::DocumentBuilder>();
    
    builder->Write(u"text");
        
    System::SharedPtr<Aspose::Words::Run> run = builder->get_Document()->get_FirstSection()->get_Body()->get_FirstParagraph()->get_Runs()->idx_get(0);
    System::Console::WriteLine(u"The phonetic guide value of the run is '{0}'", run->get_IsPhoneticGuide());
    
    /* This code produces the following output:
    The phonetic guide value of the run is 'False'
    */

Added public property Stroke.Fill

The following public property was added to the Aspose.Words.Drawing.Stroke class:

    /// Gets fill formatting for the <see cref="Aspose::Words::Drawing::Stroke">Stroke</see>.
    ASPOSE_WORDS_SHARED_API System::SharedPtr<Aspose::Words::Drawing::Fill> get_Fill();
    System::SharedPtr<Aspose::Words::DocumentBuilder> builder = System::MakeObject<Aspose::Words::DocumentBuilder>();
    System::SharedPtr<Aspose::Words::Drawing::Shape> shape = builder->InsertShape(Aspose::Words::Drawing::ShapeType::Balloon, 300, 300);
    
    // Set stroke thickness to 7pt.
    shape->get_Stroke()->set_Weight(7);
        
    // Fill the stroke with two-color gradient.
    shape->get_Stroke()->get_Fill()->TwoColorGradient(System::Drawing::Color::get_Red(), System::Drawing::Color::get_Blue(), Aspose::Words::Drawing::GradientStyle::Vertical, Aspose::Words::Drawing::GradientVariant::Variant1);
        
    builder->get_Document()->Save(u"GradientStroke.docx");

Improvements in Chart class for Combo charts

The following changes have been implemented:

  • A ChartSeriesCollection instance returned by the Chart.Series property includes all series of a combo chart, not just those of a main chart type.
  • Implemented the ChartAxisCollection class. Added the Chart.Axes property of this type, which allows access to all axes of a combo chart.
    System::SharedPtr<Aspose::Words::Document> doc = System::MakeObject<Aspose::Words::Document>(u"ComboChart.docx");
    System::SharedPtr<Aspose::Words::NodeCollection> shapes = doc->GetChildNodes(Aspose::Words::NodeType::Shape, true);
    System::SharedPtr<Aspose::Words::Drawing::Charts::Chart> chart = (System::ExplicitCast<Aspose::Words::Drawing::Shape>(shapes->idx_get(0)))->get_Chart();
    
    // Show markers in the line series named 'Series 3'.
    
    {
        auto series_enumerator = (chart->get_Series())->GetEnumerator();
        while (series_enumerator->MoveNext())
        {
            auto&& series = series_enumerator->get_Current();
            
            if (series->get_Name() == u"Series 3")
            {
                series->get_Marker()->set_Symbol(Aspose::Words::Drawing::Charts::MarkerSymbol::Circle);
                series->get_Marker()->set_Size(18);
                break;
            }
        }
    }
    
    // Hide the major grid lines on the primary and secondary Y axes.
    
    {
        auto axis_enumerator = (chart->get_Axes())->GetEnumerator();
        while (axis_enumerator->MoveNext())
        {
            auto&& axis = axis_enumerator->get_Current();
            
            if (axis->get_Type() == Aspose::Words::Drawing::Charts::ChartAxisType::Value)
            {
                axis->set_HasMajorGridlines(false);
            }
        }
    }
    
    doc->Save(u"output.docx");

New public properties for working with the shape relative positioning and sizing have been added

New public properties RelativeHorizontalSize and RelativeVerticalSize for specifying the relative size binding of the shape have been added to the Shape class:

    /// Gets or sets the value of shape's relative size in horizontal direction.
    ///
    /// The default value is <see cref="Aspose::Words::Drawing::RelativeHorizontalSize">RelativeHorizontalSize</see>.
    ///
    /// Has effect only if <see cref="Aspose::Words::Drawing::ShapeBase::get_WidthRelative">WidthRelative</see> is set.
    ASPOSE_WORDS_SHARED_API Aspose::Words::Drawing::RelativeHorizontalSize get_RelativeHorizontalSize();
    
    /// Setter for Aspose::Words::Drawing::ShapeBase::get_RelativeHorizontalSize
    ASPOSE_WORDS_SHARED_API void set_RelativeHorizontalSize(Aspose::Words::Drawing::RelativeHorizontalSize value);
    
    /// Gets or sets the value of shape's relative size in vertical direction.
    ///
    /// The default value is <see cref="Aspose::Words::Drawing::RelativeVerticalSize::Margin">Margin</see>.
    ///
    /// Has effect only if <see cref="Aspose::Words::Drawing::ShapeBase::get_HeightRelative">HeightRelative</see> is set.
    ASPOSE_WORDS_SHARED_API Aspose::Words::Drawing::RelativeVerticalSize get_RelativeVerticalSize();
    
    /// Setter for Aspose::Words::Drawing::ShapeBase::get_RelativeVerticalSize
    ASPOSE_WORDS_SHARED_API void set_RelativeVerticalSize(Aspose::Words::Drawing::RelativeVerticalSize value);

New public properties HeightRelative and WidthRelative for specifying the shape relative size in percent have been added to the Shape class:

    /// Gets the value that represents the percentage of shape's relative height.
    ASPOSE_WORDS_SHARED_API float get_HeightRelative();
    
    /// Sets the value that represents the percentage of shape's relative height.
    ASPOSE_WORDS_SHARED_API void set_HeightRelative(float value);
    
    /// Gets the value that represents the percentage of shape's relative width.
    ASPOSE_WORDS_SHARED_API float get_WidthRelative();
    
    /// Sets the value that represents the percentage of shape's relative width.
    ASPOSE_WORDS_SHARED_API void set_WidthRelative(float value);

New public properties LeftRelative and TopRelative for specifying the shape relative position in percent have been added to the Shape class:

    /// Gets the value that represents shape's relative left position in percent.
    ASPOSE_WORDS_SHARED_API float get_LeftRelative();
    
    /// Sets the value that represents shape's relative left position in percent.
    ASPOSE_WORDS_SHARED_API void set_LeftRelative(float value);
    
    /// Gets the value that represents shape's relative top position in percent.
    ASPOSE_WORDS_SHARED_API float get_TopRelative();
    
    /// Sets the value that represents shape's relative top position in percent.
    ASPOSE_WORDS_SHARED_API void set_TopRelative(float value);

New public enums RelativeHorizontalSize and RelativeVerticalSize have been introduced:

    /// Specifies relatively to what the width of a shape or a text frame is calculated horizontally.
    ///
    /// @sa Aspose::Words::Drawing::ShapeBase::get_RelativeHorizontalSize
    enum class ASPOSE_WORDS_SHARED_CLASS RelativeHorizontalSize
    
    /// Specifies relatively to what the height of a shape or a text frame is calculated vertically.
    ///
    /// @sa Aspose::Words::Drawing::ShapeBase::get_RelativeVerticalSize
    enum class ASPOSE_WORDS_SHARED_CLASS RelativeVerticalSize
    System::SharedPtr<Aspose::Words::Document> doc = System::MakeObject<Aspose::Words::Document>();
    System::SharedPtr<Aspose::Words::DocumentBuilder> builder = System::MakeObject<Aspose::Words::DocumentBuilder>(doc);
    
    // Adding a simple shape with absolute size and position.
    System::SharedPtr<Aspose::Words::Drawing::Shape> shape = builder->InsertShape(Aspose::Words::Drawing::ShapeType::Rectangle, 100, 40);
    // Set WrapType to WrapType.None since Inline shapes are automatically converted to absolute units.
    shape->set_WrapType(Aspose::Words::Drawing::WrapType::None);
    
    // Checking and setting the relative horizontal size.
    if (shape->get_RelativeHorizontalSize() == Aspose::Words::Drawing::RelativeHorizontalSize::Default)
    {
        // Setting the horizontal size binding to Margin.
        shape->set_RelativeHorizontalSize(Aspose::Words::Drawing::RelativeHorizontalSize::Margin);
        // Setting the width to 50% of Margin width.
        shape->set_WidthRelative(50.0f);
    }
    
    // Checking and setting the relative vertical size.
    if (shape->get_RelativeVerticalSize() == Aspose::Words::Drawing::RelativeVerticalSize::Default)
    {
        // Setting the vertical size binding to Margin.
        shape->set_RelativeVerticalSize(Aspose::Words::Drawing::RelativeVerticalSize::Margin);
        // Setting the height to 30% of Margin height.
        shape->set_HeightRelative(30.0f);
    }
    
    // Checking and setting the relative vertical position.
    if (shape->get_RelativeVerticalPosition() == Aspose::Words::Drawing::RelativeVerticalPosition::Paragraph)
    {
        // Setting the position binding to TopMargin.
        shape->set_RelativeVerticalPosition(Aspose::Words::Drawing::RelativeVerticalPosition::TopMargin);
        // Setting relative Top to 30% of TopMargin position.
        shape->set_TopRelative(30.0f);
    }
    
    // Checking and setting the relative horizontal position.
    if (shape->get_RelativeHorizontalPosition() == Aspose::Words::Drawing::RelativeHorizontalPosition::Default)
    {
        // Setting the position binding to RightMargin.
        shape->set_RelativeHorizontalPosition(Aspose::Words::Drawing::RelativeHorizontalPosition::RightMargin);
        // The position relative value can be negative.
        shape->set_LeftRelative(-260.0f);
    }
    
    doc->Save(u"output.docx");

Limitations and API Differences

Aspose.Words for C++ has some differences as compared to its equivalent .NET version of the API. This section contains information about all such functionality that is not available in the current release. The missing features will be added in future releases.

  • The current release does not support Metered license.
  • The current release does not support LINQ and Reporting features.
  • The current release does not support OpenGL 3D Shapes rendering.
  • The current release does not support loading PDF documents.
  • The current release has limited support for database features - C++ doesn’t have common API for DB like .NET System.Data.
  • The current release supports Microsoft Visual C++ version 2017 or higher.
  • The current release supports GCC 6.3 or higher and Clang 3.9.1 or higher on Linux and only for the x86_x64 platform.
  • The current release supports macOS Big Sur or later (11.5+) for 64-bit Intel Mac platform.