Wolfram Language & System 10.4 (2016)|Legacy Documentation

This is documentation for an earlier version of the Wolfram Language.View current documentation (Version 11.2)

ContentObject

ContentObject["string"]
gives a content object whose content is string.

ContentObject[File[]]
gives a content object whose content is stored in the specified file.

DetailsDetails

  • ContentObject[]["prop"] gives properties of the content object.
  • Possible properties include:
  • "CreationDate"creation date for file or content object
    "ModificationDate"modification date for file or content object
    "Location"location of the original source as a string
    "Plaintext"content converted to a string
    "FileByteCount"size of the content of the object on disk, in bytes
    "FileSize"size as a Quantity object
    "FileName"original file name, excluding directory
    "FileExtension"the file extension, e.g. ".txt"
    "Snippet"snippet of the content
  • ContentObject expressions returned by TextSearch refer to files on disk.
  • Some properties, such as , are typically only computed when requested.
  • The property will typically be computed by first importing an external document into the Wolfram System.

ExamplesExamplesopen allclose all

Basic Examples  (2)Basic Examples  (2)

TextSearch returns a list of content objects:

In[1]:=
Click for copyable input
Out[1]=

Get the file name of the first result:

In[2]:=
Click for copyable input
In[3]:=
Click for copyable input
Out[3]=

Create an object containing some text:

In[1]:=
Click for copyable input
Out[1]=
In[2]:=
Click for copyable input
Out[2]=

Get only a snippet of the text:

In[3]:=
Click for copyable input
Out[3]=

It is also possible to use the function Snippet:

In[4]:=
Click for copyable input
Out[4]=

Get properties of the file:

In[5]:=
Click for copyable input
Out[5]=
In[6]:=
Click for copyable input
Out[6]=
In[7]:=
Click for copyable input
Out[7]=
In[8]:=
Click for copyable input
Out[8]=

A ContentObject can contain a string:

In[9]:=
Click for copyable input
Out[9]=

ContentObject contains metadata:

In[10]:=
Click for copyable input

"Location" and "FileName" are not available if the document is not saved on disk:

In[11]:=
Click for copyable input
Out[11]=
In[12]:=
Click for copyable input
Out[12]=
Introduced in 2015
(10.2)