本文介绍了内存不足,无法继续执行程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  for  int  i =  0 ; i <  ltTemplateIndex.Count; i ++)
{
if (i == 0
{
ppMergedPres = ppSet.Open(Path.GetTempPath()+ @ \ template + i + 。ppt,MsoTriState.msoTrue,MsoTriState.msoFalse,MsoTriState.msoFalse);
ppMergedSlides = ppMergedPres.Slides;
}
else
{
ppPres = ppSet.Open(Path.GetTempPath()+ @ \ template + i + 。ppt,MsoTriState.msoTrue,MsoTriState.msoFalse,MsoTriState.msoFalse);
if (ltTemplateIndex.Count > 1
{
try
{
ppMergedSlides.InsertFromFile(Path.GetTempPath()+ @ \ template + i + 。ppt,ppMergedSlides.Count, 1 ,ppPres.Slides.Count);
}
catch (Exception ex){}
if ( ppPres!= null
ppPres.Close();

}
}
}

string directoryPath = System.Web.Hosting。 HostingEnvironment.MapPath( 〜/ Results);

if (!Directory.Exists(directoryPath))
Directory.CreateDirectory(directoryPath);

ppMergedPres.SaveAs(
Path.Combine(directoryPath,pptFileName),
PowerPoint.PpSaveAsFileType.ppSaveAsPresentation,
MsoTriState.msoFalse);

ppMergedPres.Close();
解决方案



for (int i = 0; i < ltTemplateIndex.Count; i++)
{
    if (i == 0)
    {
        ppMergedPres = ppSet.Open(Path.GetTempPath() + @"\template" + i + ".ppt", MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse);
        ppMergedSlides = ppMergedPres.Slides;
    }
    else
    {
        ppPres = ppSet.Open(Path.GetTempPath() + @"\template" + i + ".ppt", MsoTriState.msoTrue, MsoTriState.msoFalse, MsoTriState.msoFalse);
        if (ltTemplateIndex.Count > 1)
        {
            try
            {
                ppMergedSlides.InsertFromFile(Path.GetTempPath() + @"\template" + i + ".ppt", ppMergedSlides.Count, 1, ppPres.Slides.Count);
            }
            catch (Exception ex) { }
            if (ppPres != null)
                ppPres.Close();

        }
    }
}

string directoryPath = System.Web.Hosting.HostingEnvironment.MapPath("~/Results");

if (!Directory.Exists(directoryPath ))
Directory.CreateDirectory(directoryPath);

ppMergedPres.SaveAs(
Path.Combine(directoryPath, pptFileName),
PowerPoint.PpSaveAsFileType.ppSaveAsPresentation,
MsoTriState.msoFalse);

ppMergedPres.Close();
解决方案



这篇关于内存不足,无法继续执行程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-21 03:50