Framesets

Framesets

This guide shows how to read legacy frames-page structure in Aspose.Words FOSS for .NET using the Frameset and FramesetCollection classes, which represent a frames page and its child frames when a document’s structure models a set of frames.


The Frameset Class

Frameset represents a frames page or a single frame on a frames page. Document.Frameset returns the root Frameset for a document that was loaded from a framed HTML structure. FrameDefaultUrl (string) is the web page URL or document file name displayed in that frame. IsFrameLinkToFile (bool) indicates whether the FrameDefaultUrl value is an external resource the frame links to. ChildFramesets returns a FramesetCollection of the child frames and frames pages nested under this one.


Iterating Child Frames with FramesetCollection

FramesetCollection implements IEnumerable<Frameset>, so GetEnumerator() supports foreach iteration over the frames it contains. Count reports the number of frames or frames pages in the collection. Combine Count and iteration with ChildFramesets to walk a nested frames-page structure recursively — each child Frameset can itself hold further ChildFramesets.


Tips and Best Practices

  • Check Document.Frameset for null before reading its properties — most documents are not frames pages, so this property is only populated when the source HTML used a frames layout.
  • Walk ChildFramesets recursively (rather than assuming a flat, one-level structure) since a frames page can nest further frames pages inside its frames.
  • Use IsFrameLinkToFile to distinguish a frame that links to an external resource from one that embeds a document file name directly in FrameDefaultUrl.
  • FramesetCollection.Count is a cheap way to check whether a Frameset has any children before iterating.

Common Issues

IssueCauseFix
Document.Frameset is nullThe document was not loaded from a frames-based HTML sourceConfirm the source document actually used HTML frames before relying on this property
Iterating ChildFramesets misses nested framesOnly the top level was iteratedRecurse into each child Frameset.ChildFramesets rather than iterating one level deep
Can’t tell whether a frame points to a file or a URLIsFrameLinkToFile was not checkedRead IsFrameLinkToFile alongside FrameDefaultUrl to know how to resolve the target

FAQ

What is a Frameset in Aspose.Words FOSS for .NET?

It represents a frames page or a single frame on a frames page, exposed as Document.Frameset for documents loaded from a frames-based HTML source.

How do I list all frames in a frameset?

Iterate Frameset.ChildFramesets (a FramesetCollection) with GetEnumerator() / foreach, recursing into any child that itself has further ChildFramesets.

How do I know how many child frames a Frameset has?

Read FramesetCollection.Count on its ChildFramesets property.

What does IsFrameLinkToFile tell you?

Whether the web page or document file name in FrameDefaultUrl is an external resource the frame is linked to.


API Reference Summary

Class/MethodDescription
Document.FramesetRoot Frameset for a document loaded from a frames-based HTML source
FramesetRepresents a frames page or a single frame on a frames page
Frameset.FrameDefaultUrlWeb page URL or document file name displayed in the frame
Frameset.IsFrameLinkToFileWhether FrameDefaultUrl is an external linked resource
Frameset.ChildFramesetsFramesetCollection of child frames and frames pages
FramesetCollectionCollection of Frameset instances; Count, GetEnumerator

See Also