请问Aspose.Total for .NET可以从一个PPT中调取某一页的页码吗?有相关资料吗?
谢谢
请问Aspose.Total for .NET可以从一个PPT中调取某一页的页码吗?有相关资料吗?
谢谢
我已经观察到了你的要求。 按页码是指所选幻灯片的幻灯片编号? 如果这是要求,那么我建议您尝试使用以下相同的代码。
Presentation pres = new Presentation("Test.pptx");
int slideNumber = pres.Slides[0].SlideNumber;
你好 ,如果是word文档的页码呢?
谢谢你的询问。 如果您想获得Word文档的页数,请使用Document.PageCount属性。 如果要获取文本,图像,表格等的页码,可以使用LayoutCollector.GetStartPageIndex获取节点开始的页面的从1开始的索引。
你好,我是想在word中,通过书签来调取页码,怎么实现呢?
谢谢你的询问。 下面的代码示例显示了如何获取书签的页码。
Document doc = new Document(MyDir + "in.docx");
LayoutCollector collector = new LayoutCollector(doc);
//Get the first bookmark of document
Bookmark bm = doc.Range.Bookmarks[0];
Console.WriteLine(collector.GetStartPageIndex(bm.BookmarkStart));
你好,有两个问题确认一下
1、word中通过书签调取页码,我的代码如下:
while (startPage != endPage)
{
builder.MoveToBookmark("JianYi");
builder.InsertBreak(BreakType.LineBreak);
bmStart = oDoc.Range.Bookmarks["Start"];
startPage = collector.GetStartPageIndex(bmStart.BookmarkStart);
}
在标签"JianYi"(在标签"Start"前)处增加空行,但是取到标签"Start"的页码一直不变,成了死循环。
怎么样才能让标签"Start"的页码改变能?
2、Ppt中的文字,能否增加阴影和三维效果?能否提供些代码?
谢谢你的询问。 您正在通过在while循环中插入分页符来更新页面布局。 在获取页码之前,您需要使用Document.UpdatePageLayout更新页面布局。
您能否分享一些关于您的要求的更多细节以及输入和预期的输出文件? 然后,我们将为您提供有关查询的更多信息。
你好,附件PPT文字样式.zip (91.8 KB)
是我想要的文字效果,加了文本框以后,如何设置文字效果?
找到一些参数,如PortionFormat.EffectFormat.OuterShadowEffect,但是具体不清楚。
我也可以在模版里设置一个文本框,把字体参数都设好,但是不知道怎么把它拷贝到其他页面,
MS Office里可以通过如下语句实现:
m_Pres.Slides[1].Shapes[5].Copy(); // 从第一个Slide中拷贝第5个shape
m_Slide.Shapes.Paste(); // 拷贝到指定的Slide中
我们是否有这个功能?也可以解决文字效果问题。
谢谢,页码已经可以正常调取。
我建议您尝试使用以下示例代码对文本应用阴影效果。
public static void AddTextEffects()
{
using (Presentation pres = new Presentation())
{
IAutoShape shape = pres.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 10, 10, 100, 20);
shape.FillFormat.FillType = FillType.NoFill;
shape.TextFrame.Text = "Test Shadow Effects";
IPortion portion = shape.TextFrame.Paragraphs[0].Portions[0];
IEffectFormat effectFormat = portion.PortionFormat.EffectFormat;
portion.PortionFormat.FillFormat.FillType = FillType.Solid;
portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
portion.PortionFormat.FontHeight = 14;
effectFormat.EnableOuterShadowEffect();
effectFormat.OuterShadowEffect.BlurRadius = 10;
effectFormat.OuterShadowEffect.Distance = 2;
pres.Save("C:\\Aspose Data\\effects.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
}
}
谢谢回复。有两个问题需要确认一下:
1、阴影的效果根据你的代码试过了。我这里需要设置5个参数,其中透明度和大小两个字段没找到。请问在哪里查找?
2、你发送的代码只是针对于阴影效果,三维效果我们也是需要的,就丢失参数而已。请问怎么设置三维格式?
您可以使用应用程序中的以下示例代码设置大小。 但是,目前API中没有设置透明度,并且在我们的问题跟踪系统中添加了ID SLIDESNET-40783的问题以提供支持。
effectFormat.OuterShadowEffect.ScaleHorizontal = 75;
effectFormat.OuterShadowEffect.ScaleVertical = 75;
可以使用以下示例代码添加3D效果。 但是,用于设置阴影效果的API似乎存在问题,并且已创建ID SLIDESNET-40784的问题以解决此问题。
ThreeDFormat ThDFromat = (ThreeDFormat)shape.ThreeDFormat;
ThDFromat.BevelTop.BevelType = BevelPresetType.Circle;
ThDFromat.BevelTop.Height = 3;
ThDFromat.BevelTop.Height = 3;
对于您的以下要求,建议您尝试使用以下代码。
public static void AddTextEffects()
{
using (Presentation pres = new Presentation())
{
IAutoShape shape = pres.Slides[0].Shapes.AddAutoShape(ShapeType.Rectangle, 10, 10, 100, 20);
shape.FillFormat.FillType = FillType.Solid;
shape.FillFormat.SolidFillColor.Color = Color.Green;
shape.TextFrame.Text = "Test Shadow Effects";
IPortion portion = shape.TextFrame.Paragraphs[0].Portions[0];
IEffectFormat effectFormat = portion.PortionFormat.EffectFormat;
portion.PortionFormat.FillFormat.FillType = FillType.Solid;
portion.PortionFormat.FillFormat.SolidFillColor.Color = Color.Black;
portion.PortionFormat.FontHeight = 14;
effectFormat.EnableOuterShadowEffect();
effectFormat.OuterShadowEffect.BlurRadius = 10;
effectFormat.OuterShadowEffect.Distance = 2;
// effectFormat.OuterShadowEffect.r
ThreeDFormat ThDFromat = (ThreeDFormat)shape.ThreeDFormat;
ThDFromat.BevelTop.BevelType = BevelPresetType.Circle;
ThDFromat.BevelTop.Height = 13;
ThDFromat.BevelTop.Width = 23;
//Set LightType and CameraType (Material is not necessary, MaterialPresetType.WarmMatte will be used by default) =====>
ThDFromat.Camera.CameraType = CameraPresetType.OrthographicFront;
ThDFromat.LightRig.LightType = LightRigPresetType.ThreePt;
ThDFromat.Material = MaterialPresetType.WarmMatte;
pres.Save("C:\\Aspose Data\\effects2.pptx", Aspose.Slides.Export.SaveFormat.Pptx);
}
}