إدارة تعليقات العرض التقديمي في C++

في PowerPoint، يظهر التعليق كملاحظة أو شرح على الشريحة. عند النقر على التعليق، تُظهر محتوياته أو رسائله.

لماذا إضافة تعليقات إلى العروض التقديمية؟

قد ترغب في استخدام التعليقات لتقديم ملاحظات أو التواصل مع زملائك عند مراجعة العروض التقديمية.

للسماح لك باستخدام التعليقات في عروض PowerPoint، توفر Aspose.Slides for C++

  • الفئة Presentation التي تحتوي على مجموعات المؤلفين (من طريقة get_CommentAuthors()). يضيف المؤلفون تعليقات إلى الشرائح.
  • الواجهة ICommentCollection التي تحتوي على مجموعة التعليقات للكاتب الفردي.
  • الفئة IComment التي تحتوي على معلومات عن المؤلفين وتعليقاتهم: من أضاف التعليق، وقت إضافة التعليق، موضع التعليق، إلخ.
  • الفئة CommentAuthor التي تحتوي على معلومات عن كل كاتب: اسم الكاتب، الأحرف الأولى له، التعليقات المرتبطة باسمه، إلخ.

إضافة تعليق إلى الشريحة

هذا الكود C++ يوضح لك كيفية إضافة تعليق إلى شريحة في عرض PowerPoint:

// إنشاء كائن من الفئة Presentation
auto presentation = System::MakeObject<Presentation>();
// إضافة شريحة فارغة
presentation->get_Slides()->AddEmptySlide(presentation->get_LayoutSlides()->idx_get(0));

// إضافة مؤلف
auto author = presentation->get_CommentAuthors()->AddAuthor(u"Jawad", u"MF");

// تحديد موضع التعليقات
PointF point;
point.set_X(0.2f);
point.set_Y(0.2f);

// الوصول إلى ISlide 1
auto slide1 = presentation->get_Slides()->idx_get(0);
// الوصول إلى ISlide 2
auto slide2 = presentation->get_Slides()->idx_get(1);

// إضافة تعليق شريحة لمؤلف على الشريحة 1
author->get_Comments()->AddComment(u"Hello Jawad, this is slide comment", slide1, point, DateTime::get_Now());

// إضافة تعليق شريحة لمؤلف على الشريحة 2
author->get_Comments()->AddComment(u"Hello Jawad, this is second slide comment", slide2, point, DateTime::get_Now());

// عند تمرير null كمعامل، يتم جلب التعليقات من جميع المؤلفين إلى الشريحة المحددة
auto comments = slide1->GetSlideComments(author);

// Accesses the comment at index 0 for slide 1
String str = comments[0]->get_Text();

presentation->Save(u"Comments_out.pptx", SaveFormat::Pptx);

if (comments->GetLength(0) > 0)
{
    // اختيار مجموعة تعليقات المؤلف عند الفهرس 0
    auto commentCollection = comments[0]->get_Author()->get_Comments();
    String Comment = commentCollection->idx_get(0)->get_Text();
}

الوصول إلى تعليقات الشريحة

هذا الكود C++ يوضح لك كيفية الوصول إلى تعليق موجود على شريحة في عرض PowerPoint:

// إنشاء كائن من فئة Presentation
auto presentation = System::MakeObject<Presentation>(u"Comments1.pptx");

for (auto&& commentAuthor : presentation->get_CommentAuthors())
{
    auto author = System::ExplicitCast<CommentAuthor>(commentAuthor);
    for (auto&& comment1 : System::IterateOver(author->get_Comments()))
    {
        SmartPtr<Comment> comment = System::ExplicitCast<Comment>(comment1);
        Console::WriteLine(String(u"ISlide :")
                        + comment->get_Slide()->get_SlideNumber()
                        + u" has comment: " + comment->get_Text()
                        + u" with Author: " + comment->get_Author()->get_Name()
                        + u" posted on time :" + comment->get_CreatedTime() + u"\n");
    }
}

الرد على التعليقات

التعليق الأصلي هو أعلى أو أول تعليق في هيكلية التعليقات أو الردود. باستخدام خاصية ParentComment من واجهة IComment، يمكنك تعيين أو الحصول على التعليق الأصلي.

هذا الكود C++ يوضح لك كيفية إضافة تعليقات والحصول على الردود عليها:

auto pres = System::MakeObject<Presentation>();

// الوصول إلى ISlide 1
auto slide1 = pres->get_Slides()->idx_get(0);

// إضافة تعليق
auto author1 = pres->get_CommentAuthors()->AddAuthor(u"Author_1", u"A.A.");
auto comment1 = author1->get_Comments()->AddComment(u"comment1", slide1, PointF(10.0f, 10.0f), DateTime::get_Now());

// إضافة رد إلى التعليق 1
auto author2 = pres->get_CommentAuthors()->AddAuthor(u"Autror_2", u"B.B.");
auto reply1 = author2->get_Comments()->AddComment(u"reply 1 for comment 1", slide1, PointF(10.0f, 10.0f), DateTime::get_Now());
reply1->set_ParentComment(comment1);

// إضافة رد آخر إلى التعليق 1
auto reply2 = author2->get_Comments()->AddComment(u"reply 2 for comment 1", slide1, PointF(10.0f, 10.0f), DateTime::get_Now());
reply2->set_ParentComment(comment1);

// إضافة رد إلى الرد الموجود
auto subReply = author1->get_Comments()->AddComment(u"subreply 3 for reply 2", slide1, PointF(10.0f, 10.0f), DateTime::get_Now());
subReply->set_ParentComment(reply2);

auto comment2 = author2->get_Comments()->AddComment(u"comment 2", slide1, PointF(10.0f, 10.0f), DateTime::get_Now());
auto comment3 = author2->get_Comments()->AddComment(u"comment 3", slide1, PointF(10.0f, 10.0f), DateTime::get_Now());

auto reply3 = author1->get_Comments()->AddComment(u"reply 4 for comment 3", slide1, PointF(10.0f, 10.0f), DateTime::get_Now());
reply3->set_ParentComment(comment3);

// عرض هيكلية التعليقات على وحدة التحكم
auto comments = slide1->GetSlideComments(nullptr);
for (int32_t i = 0; i < comments->get_Length(); i++)
{
    auto comment = comments[i];
    while (comment->get_ParentComment() != nullptr)
    {
        Console::Write(u"\t");
        comment = comment->get_ParentComment();
    }

    Console::Write(u"{0} : {1}", comments[i]->get_Author()->get_Name(), comments[i]->get_Text());
    Console::WriteLine();
}

pres->Save(u"parent_comment.pptx", SaveFormat::Pptx);

// إزالة التعليق 1 وكل الردود عليه
comment1->Remove();

pres->Save(u"remove_comment.pptx", SaveFormat::Pptx);

إضافة تعليق حديث

في عام 2021، قدمت Microsoft التعليقات الحديثة في PowerPoint. تحسّن ميزة التعليقات الحديثة بشكل كبير التعاون في PowerPoint. من خلال التعليقات الحديثة، يمكن لمستخدمي PowerPoint حل التعليقات، ربط التعليقات بالكائنات والنصوص، والتفاعل بسهولة أكبر مما كان سابقًا.

في Aspose Slides for C++ 21.11، نفّذنا دعم التعليقات الحديثة بإضافة الفئة ModernComment. أضيفت طريقتا AddModernComment وInsertModernComment إلى فئة CommentCollection.

هذا الكود C++ يوضح لك كيفية إضافة تعليق حديث إلى شريحة في عرض PowerPoint:

auto pres = System::MakeObject<Presentation>();
// الوصول إلى ISlide 1
auto slide1 = pres->get_Slides()->idx_get(0);

auto newAuthor = pres->get_CommentAuthors()->AddAuthor(u"Some Author", u"SA");
auto modernComment = newAuthor->get_Comments()->AddModernComment(u"This is a modern comment", slide1, nullptr, PointF(100.0f, 100.0f), DateTime::get_Now());

pres->Save(u"pres.pptx", SaveFormat::Pptx);

إزالة تعليق

حذف جميع التعليقات والمؤلفين

هذا الكود C++ يوضح لك كيفية حذف جميع التعليقات والمؤلفين في عرض:

using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace System::Drawing;

auto presentation = System::MakeObject<Presentation>(u"example.pptx");

// حذف جميع التعليقات من العرض التقديمي
for (auto author : presentation->get_CommentAuthors())
{
    author->get_Comments()->Clear();
}
        
// حذف جميع المؤلفين
presentation->get_CommentAuthors()->Clear();
presentation->Save(u"example_out.pptx", SaveFormat::Pptx);

حذف تعليقات محددة

هذا الكود C++ يوضح لك كيفية حذف تعليقات محددة على شريحة:

using namespace Aspose::Slides;
using namespace Aspose::Slides::Export;
using namespace System::Drawing;

auto presentation = System::MakeObject<Presentation>();
auto slide = presentation->get_Slides()->idx_get(0);
        
// إضافة تعليقات...
auto author = presentation->get_CommentAuthors()->AddAuthor(u"Author", u"A");
author->get_Comments()->AddComment(u"comment 1", slide, PointF(0.2f, 0.2f), System::DateTime::get_Now());
author->get_Comments()->AddComment(u"comment 2", slide, PointF(0.3f, 0.2f), System::DateTime::get_Now());
        
// إزالة جميع التعليقات التي تحتوي على النص "comment 1"
for (auto commentAuthor : presentation->get_CommentAuthors())
{
    auto toRemove = System::MakeObject<System::Collections::Generic::List<System::SharedPtr<IComment>>>();
    for (auto comment : slide->GetSlideComments(commentAuthor))
    {
        if (comment->get_Text() == u"comment 1")
        {
            toRemove->Add(comment);
        }
    }
    for (auto comment : toRemove)
    {
        commentAuthor->get_Comments()->Remove(comment);
    }
}
        
presentation->Save(u"pres.pptx", SaveFormat::Pptx);

الأسئلة المتكررة

هل يدعم Aspose.Slides حالة مثل ‘محلول’ للتعليقات الحديثة؟

نعم. تُظهر Modern comments طرقًا get_Status وset_Status. يمكنك قراءة وتعيين حالة التعليق (على سبيل المثال، وضع علامة “محلول”)، وتُحفظ هذه الحالة في الملف وتتعرف عليها PowerPoint.

هل تدعم المناقشات المتسلسلة (سلاسل الردود)، وهل هناك حد للتعمق؟

نعم. يمكن لكل تعليق الإشارة إلى parent comment، مما يسمح بسلاسل ردود غير محدودة. لا تُعلن الواجهة عن حد معين لعمق التعمق.

في أي نظام إحداثيات يتم تعريف موضع علامة التعليق على الشريحة؟

يُخزن الموضع كنقطة ذات قيمة عائمة في نظام إحداثيات الشريحة. يتيح لك ذلك وضع علامة التعليق بدقة في المكان الذي تحتاجه.