We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Managing Fonts FontsBold missing RawFontBold available

Hi Guys,

we are in the process of upgrading our ppt engine to pptx by rewriting and converting the code using the pptx namespace. having few difficulties:

one is according to the documentation here when i try to set font properties i don’t get the fontBold or any other properties as the document says. it only shows them as RawFontBold etc?

and also what is the item that i need to use to get the functionality done using the textRulerm,BulletOffset, TextOffset

//PPTX-Revise NEEDED
for (short rulerCount = 0; rulerCount < 5; rulerCount++)
{
cell.TextFrame.TextRuler.Levels[rulerCount].BulletOffset = cellProperty.RulerBulletOffset[rulerCount]; //First-line indent marker
cell.TextFrame.TextRuler.Levels[rulerCount].TextOffset = cellProperty.RulerTextOffset[rulerCount]; //Left indent marker

}



awaiting for your suggestions im using Aspose 3.x

Thanks,
Aneef

Dear Aneef,

I am sorry for the delayed response.

I have executed the code snippet mentioned by you in your post and have been able to observe the effect of all mentioned properties inside the code along with font bold property. Please note that the documentation shared is updated with respect to latest product version. Please use Aspose.Slides for .NET 4.2.0 available here and hopefully things will start to work for you.

For text ruler, bullet offset and text offset properties, I am in consultation with our development team and as soon as some information is shared, I will be glad to share that with you as well.

We are sorry for your inconvenience,

Hi Mudassir,

Thanks for your update. yes i found out this and informed to our management to update our licence to get the 4.2 version and they will be doing it today.

please try to find out the solution regarding the text ruler etc. and also another major issue i found was in accessing metacharecters in master slides and then the masterID of a slide.

awaiting for your response.

thanks,
Aneef

Dear Aneef,

In case of PPTX you may use LeftMargin and Indent properties of ParagraphEx class to add the text offset and bullets offset to slide contents. Please follow this link to find more details about the LeftMargin and this link for text indent properties. Text ruler is unfortunately unavailable in case of Aspose.Slides.Pptx. But the mentioned properties can be used to serve the purpose. Secondly, please use the code snippet below to get the ID of a particular slide's master slide. Please share some details about your access to met characters.

PresentationEx pres = new PresentationEx("D:\\Aspose Data\\tpres.pptx");<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

MasterSlideEx Masslide = pres.Slides[0].LayoutSlide.MasterSlide;

uint MID = Masslide.SlideId;

uint SID = pres.Slides[0].SlideId;

Thanks and Regards,

Thanks alot mudssir.

Aneef

Hi,

We use the following code to get the page number metacharecter in a master slide to set our custom page number formats (i’ve posted a partial code)

foreach (Shape shp in mstr.Shapes)
{
TextFrame tf = shp.TextFrame;
if (tf != null)
{
if (tf.MetaCharacters != null)
{
try
{
MetaCharacterType metaType = tf.MetaCharacters[0];
if (metaType == MetaCharacterType.SlideNumer)
{

Hi Aneef,

We regret to inform you that PPTX format does not have Meta characters, so no MetaCharacterType class implementation for PPTX is available. As a work around, you can please try adding a text frame containing the current slide position and a total slides in presentation in your own format on individual slide level. Unfortunately in PPTX, you cannot add on Master Slide level as in case of PPT. I have already shared my comments on this issue over this thread link a few months ago.

An issue with ID 19359 has been created in our issue tracking system to look in to the possibility of implementation of the requested feature. This thread has also been linked with the issue, so that you may be automatically notified when the issue is resolved.

We are sorry for your inconvenience,

Hi

Yes we have implemented the workaround you mentioned in the previous thread. the problem that we are facing is that we need to find out the place of the placeholder for page numbering in the master, so our reporting engine will create the textframes in the exact location in each slide so it works like a real page numbering. how can we achieve this ?

will these shapes come when we process SlideEX.Shapes?

Dear Aneef,

I have implemented the work around method for your ease and understanding. Please use the code snippet given below to extract the position and size of the shape containing slide number inside master slide. After extraction of position and size an equivalent shape is generated in the desired slide and displaying the slide position.

PresentationEx pres = new PresentationEx();
//Adding new slide
int Index = pres.getSlides().addEmptySlide (pres.getLayoutSlides().get (0));
SlideEx slide=pres.getSlides ().get(Index);
//Master slide for added slide
MasterSlideEx mstr=slide.getLayoutSlide().getMasterSlide();
ShapeEx shp;

double X=0,Y=0,width=0,height=0;

//Traversing through all shapes master slide and finding
//position of shape containing the slide number
//The position can be extrated once and can be used for every new slide
for (int iCount=0; iCount<mstr.getShapes ().size();iCount++)
{
shp=mstr.getShapes().get (iCount);

if (shp instanceof AutoShapeEx)
{
AutoShapeEx ashp = (AutoShapeEx)shp;

if (ashp.getTextFrame() != null)
{
//Matching string of slide position in master slide and getting the
//shape position and size
if(ashp.getTextFrame().getText ().contains("#")==true)
{
X=ashp.getX();
Y=ashp.getY();
width=ashp.getWidth();
height=ashp.getHeight();
}
}
}
}
//Removing default slide at zero index
pres.getSlides().remove (pres.getSlides().get (0));
//Creating the equavlent text frame as in master slide
Index=slide.getShapes ().addAutoShape (ShapeTypeEx.RECTANGLE,(float)X,(float)Y,(float)width,(float)height);
AutoShapeEx aPosition= ( AutoShapeEx) (slide.getShapes ().get (Index) ) ;
//Finding slide position
String sPos=Integer.toString(pres.getSlides().indexOf (slide)+1);
//Setting slide position
aPosition.getTextFrame ().setText (sPos);
//Saving Presentation
pres.write("D://Aspose Data//NewSlidePosition.pptx");

Thanks and Regards,

Hi,


This is what I have already implemented. thought it wont be a better solution. but seems its the only way to go. hope u guys will have something on these in future.

for now i will go with this.

Hi Mudassir,

//PPTX-Revise NEEDED
for (short rulerCount = 0; rulerCount < 5; rulerCount++)
{
cell.TextFrame.TextRuler.Levels[rulerCount].BulletOffset = cellProperty.RulerBulletOffset[rulerCount]; //First-line indent marker
cell.TextFrame.TextRuler.Levels[rulerCount].TextOffset = cellProperty.RulerTextOffset[rulerCount]; //Left indent marker

}

I tried to use the following properties of ParagraphEx class as per your posting to set TextOffset and BulletOffset to a CellEx,

1. LeftMargin - used for TextOffSet

2. Indent - used for BulletOffset

but I could not get any output.

Can you please brief on the usage of these two properties to achieve the outcome of the codesnippet given above?

Yasindu.

Hi Yasindu,

I have used the following code snippet for setting the margin and indent for the paragraphs. It seems to work for me. For your kind reference, I have also attached the generated presentation. Please share with us, if you may feel any issue.

PresentationEx pres = new PresentationEx();<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

//Accessing first slide

SlideEx slide = pres.Slides[0];

slide.Shapes.AddAutoShape(ShapeTypeEx.Rectangle, 0, 0, 500, 100);

slide.Shapes.AddAutoShape(ShapeTypeEx.Rectangle, 0, 105, 500, 100);

//Accessing the first and second placeholder in the slide and typecasting it as AutoShape

TextFrameEx tf1 = ((AutoShapeEx)slide.Shapes[0]).TextFrame;

TextFrameEx tf2 = ((AutoShapeEx)slide.Shapes[1]).TextFrame;

//Change the text in both placeholders

tf1.Text = "Margin by Aspose";

tf2.Text = "Indent by Aspose";

//Getting the first paragraph of the placeholders

ParagraphEx para1 = tf1.Paragraphs[0];

ParagraphEx para2 = tf2.Paragraphs[0];

para2.BulletType = BulletTypeEx.Numbered;

para1.MarginLeft = 72;

para2.Indent=144;

float Par1Margin = para1.MarginLeft;

// float Para2Indent = para2.Indent;

//Writing the presentation as a PPTX file

pres.Write("d:\\MarginIndentAlign.pptx");

Thanks and Regards,