예제 #1
0
 /**
  * determines whether specified CharacterRun Contains reference to a picture
  * @param run
  */
 public bool HasHorizontalLine(CharacterRun run)
 {
     if (run.IsSpecialCharacter() && "\u0001".Equals(run.Text))
     {
         return(IsBlockContainsHorizontalLine(run.GetPicOffset()));
     }
     return(false);
 }
예제 #2
0
 /**
  * Returns picture object tied to specified CharacterRun
  * @param run
  * @param FillBytes if true, Picture will be returned with Filled byte array that represent picture's contents. If you don't want
  * to have that byte array in memory but only write picture's contents to stream, pass false and then use Picture.WriteImageContent
  * @see Picture#WriteImageContent(java.io.OutputStream)
  * @return a Picture object if picture exists for specified CharacterRun, null otherwise. PicturesTable.hasPicture is used to determine this.
  * @see #hasPicture(NPOI.HWPF.usermodel.CharacterRun)
  */
 public Picture ExtractPicture(CharacterRun run, bool FillBytes)
 {
     if (HasPicture(run))
     {
         return(new Picture(run.GetPicOffset(), _dataStream, FillBytes));
     }
     return(null);
 }
예제 #3
0
 /**
  * determines whether specified CharacterRun Contains reference to a picture
  * @param run
  */
 public bool HasPicture(CharacterRun run)
 {
     if (run.IsSpecialCharacter() && !run.IsObj() && !run.IsOle2() && !run.IsData())
     {
         // Image should be in it's own run, or in a run with the end-of-special marker
         if ("\u0001".Equals(run.Text) || "\u0001\u0015".Equals(run.Text))
         {
             return(IsBlockContainsImage(run.GetPicOffset()));
         }
     }
     return(false);
 }
예제 #4
0
        private bool ProcessOle2(HWPFDocument doc, CharacterRun characterRun,
                                 XmlElement block)
        {
            Entry entry = doc.GetObjectsPool().GetObjectById("_" + characterRun.GetPicOffset());

            if (entry == null)
            {
                logger.Log(POILogger.WARN, "Referenced OLE2 object '", (characterRun.GetPicOffset()).ToString(), "' not found in ObjectPool");
                return(false);
            }

            try
            {
                return(ProcessOle2(doc, block, entry));
            }
            catch (Exception exc)
            {
                logger.Log(POILogger.WARN,
                           "Unable to convert internal OLE2 object '", (characterRun.GetPicOffset()).ToString(), "': ", exc, exc);
                return(false);
            }
        }